home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Ham⁄GPS / NET⁄Mac Starters kit / Docs & Help / Bdale’s Documentation next >
Text File  |  1991-04-20  |  177KB  |  1,947 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14. The KA9Q Internet Software Package
  15.  
  16.  
  17. Preliminary Version
  18.  
  19. January 30, 1988
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. by
  27. Bdale Garbee, N3EUA
  28.  
  29. using material from
  30. Phil Karn, KA9Q
  31. Brian Lloyd, WB6RQN
  32. and suggestions from many others
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. Copyright 1988 by Bdale Garbee, Phil Karn and Brian Lloyd.
  41. All Rights Reserved.
  42.  
  43. This Document may be reproduced in whole
  44. or in part for any non-commercial purpose,
  45. as long as credit is given the authors.
  46.  
  47. 1.  Background and Overview
  48.  
  49. 1.1.  What's TCP/IP All About?
  50.  
  51. Charles Hedrick of RUTGERS, the State University of New Jersey, has written a very important document... a description of the "world of TCP/IP" that manages to be both a reasonable introduction for the non-technical or mildly technical individual, and an excellent starting point for anyone interested in learning more about the family of networking protocols commonly referred to as "TCP/IP".
  52.  
  53. The only difficulty with this document for those who are trying to learn more about TCP/IP in the Amateur Radio "Packet" environment, is that the experience Mr. Hedrick works from is almost entirely with the wired networks common in universities and businesses, where various computer systems are networked together using some form of wire (usually coaxial cable as in Ethernet, or fiber optic cabling as in Pronet).
  54.  
  55. The individual who is familiar with radio transmission will easily recognize differences between the wired environment and the on-air environment.  This does not mean that the protocols are unfit for use on the air, it simply means that we need to be careful when *implementing* the protocols in software for use on the radio that we don't make assumptions that aren't valid on the air! In particular, wired networks allow the assumption that every host can hear every other host on the wire... quite unlike the situation in radio, where one-way propagation paths are often the norm.
  56.  
  57. Mr. Hedrick mentions several protocols that can "ride on top of" IP, such as Sun's Network File System, NFS.  Some of the applications that he talks about, including NFS, while wonderful on wired networks, are somewhat unreasonable for packet radio until or unless we have *much* higher speed modems.  Wired networks can easily run at 10 million bits per second, while packet ranges from 300 bits per second on HF, to perhaps 56 thousand bits per second with the WA4DSY modems on UHF.  Therefore, some of the protocols such as NFS that like to eat lots of network bandwith won't be as neat on current packet radio as they are on current wired networks, but they certainly provides a dramatic improvement in potential services for the "next generation" of packet radio.
  58.  
  59. The KA9Q Internet Package is currently the most common TCP/IP implementation (if not the only one!) in use on Amateur Packet Radio.  The software supports the IBM PC and clones, the Apple Macintosh, the Commodore Amiga, and both BSD and System 5 Unix variants.  The package provides IP, ICMP, TCP, UDP, and ARP as basic services, and implements the FTP, Telnet, and SMTP protocols as applications.  The package also includes a separate mail user interface program by N3EUA called BM, and software from WA3PXX for forwarding PBBS mail over TCP.  An associated set of software packages provide replacement ROM firmware for several TNC's, allowing them to be used with the KA9Q TCP/IP Package.  At least two commercial manufacturers, AEA and Kantronics, now support the KISS protocol in their TNC's, making them usable with TCP/IP.
  60.  
  61. Charles Hedrick's excellent introduction to TCP/IP can be found in the same place you found this document, named TUTORIAL.DOC.  If you're new to all this, go find and read that before you get too wound up in the bits...
  62.  
  63.  
  64. 1.2. What's in the KA9Q Package
  65.  
  66. This is an overview of the various modules making up the KA9Q Amateur Radio Internet Protocol package.  Each section first describes the protocol that is supported, followed by a description of the implementation.
  67.  
  68. 1.2.1 Subnet Layer
  69.  
  70. 1.2.1.1. Standard 10 megabit Ethernet
  71.  
  72. The driver provided is for the 3-Com 3C500 (IE) controller for the PC.  Tight assembler loops are used instead of DMA for copying data in and out of the controller's buffer; this seems fast enough.  Only the receiver is interrupt driven; incoming packets are placed on a queue which is then emptied at a more leisurely pace by the main loop code.  Since Ethernet is so fast, the transmitter routine busy-waits for completion.  The IE controller has only a single buffer which is shared between receive and transmit.  Packets occasionally get lost under heavy load, especially when several TCP connections are active at once and/or the TCP receive window sizes are larger than the MSS values.  This is very hard to fix without going to a newer, more reasonably designed controller.
  73.  
  74. 1.2.1.2. Serial Line IP (SLIP)
  75.  
  76. SLIP is a very simple technique for sending Internet Datagrams across ordinary asynchronous lines (e.g., modems).  Its only function is to delimit datagrams with framing characters, which are "byte stuffed" for transparency.  No error checking is provided; the checksums that are part of IP, TCP and UDP are relied on for this.  SLIP is popular on UNIX systems that support TCP/IP, so this represented the easiest way to get my package up and talking with other Internet sites.  It also allows the use of existing AX.25 TNCs without modifying the latter, although this is should only be done as a stopgap measure until an HDLC link level driver can be integrated directly into the package.
  77.  
  78. 1.2.1.3. AX.25/KISS TNC
  79.  
  80. Sends and receives IP and ARP datagrams encapsulated in AX.25 Unnumbered Information (UI) frames.  This allows an unlimited number of simultaneous users on the local radio channel, since there are no connections at link level.  The special AX.25 Level 3 Protocol ID values of hex CC (IP) and CD (ARP) are used.
  81.  
  82. With the 871225.0 release, support has also been added for encapsulating IP datagrams in "normal" AX.25 connected-mode packets.  This was a natural by-product of adding full AX.25 level 2 session support to the package.
  83.  
  84. This mode of operation requires that the TNC run special "KISS TNC" code.  Versions for the TNC-2, TNC-1, and VADCG/ASHBY boards are included in this distribution.  Some manufacturers, including AEA and Kantronics, are adding support for KISS into their commercial TNC products.  Note that this style of operation is NOT compatible with a "stock" TNC carrying SLIP format datagrams in connected mode.
  85.  
  86.  
  87.  
  88. 1.2.1.4. AX.25/PACCOMM PC-100 Interface (NOT YET WORKING)
  89.  
  90. The PC-100 is an I/O adapter card for the PC containing a Zilog 8530 Serial Communications Controller and two AMD 7910 World Chip modems.  The encapsulation method is identical to (and compatible with) the AX.25/KISS TNC interface driver.
  91.  
  92. 1.2.1.5. AX.25/Eagle Interface
  93.  
  94. There is a card available at some swapfests made by Eagle Computer Company that implements two ports using the Zilog 8530.  External modems are required.  This driver is very similar to (and may eventually be merged with) the PC-100 driver.
  95.  
  96. 1.2.1.6. Address Resolution Protocol (ARP)
  97.  
  98. ARP is used for the automatic mapping of IP addresses to link or subnet addresses.  While originally designed for the specific task of mapping IP to Ethernet addresses, the protocol is general enough to be used on any link or subnet that supports a broadcast facility.  ARP is described in ARPA RFC-826.
  99.  
  100. Both Ethernet and AX.25 format addresses are currently supported.  Instead of discarding a packet when an ARP request is sent, this implementation holds it on a queue for a limited time, pending a response to the request.
  101.  
  102. 1.2.2. Internet Layer
  103.  
  104. 1.2.2.1. Internet Protocol (IP)
  105.  
  106. IP is the universal network-level datagram protocol of the ARPA Internet.  It corresponds roughly to level 3 of the ISO Reference Model (ISORM).  (Actually, IP belongs to the 3B internetwork sublayer if you follow the amoeboid proliferation of ISO sublayers).  Routines are provided to generate, receive and route (i.e., packet switch) IP datagrams.  IP is specified in ARPA RFC-791 and MIL-STD-1777.
  107.  
  108. IP datagram fragmentation and reassembly is fully implemented.  The IP options Loose Source Routing, Strict Source Routing and Record Route are supported; Stream ID, Security and Timestamp are ignored.  (Few, if any, IP options are used extensively in the ARPA Internet).  The IP module includes a routing (packet switching) facility; currently this consists of a table containing a list of host-specific destinations along with a "default" entry that may be used when the desired destination is not found in the table.  No protocol is yet provided to actually manage the table; currently it must be done manually, either locally or remotely.  NB! "Networks" (in the ARPA Class-A/B/C sense) are not yet understood, in that all entries in the routing table (except for the default entry) must be host-specific.  This will be fixed in the future with a "generalized subnetting" scheme that will allow each entry in the table to have an arbitrary, variable length "subnet mask."
  109.  
  110. 1.2.2.2. Internet Control Message Protocol (ICMP)
  111.  
  112. ICMP is the error reporting adjunct to IP.  It appears as a pseudo-protocol on top of IP, but is actually considered to be part of IP.  The IP routines automatically generate ICMP messages whenever an error occurs in the processing of IP datagrams; incoming ICMP messages are passed up to the originating end-to-end protocol for appropriate action.  ICMP is specified in ARPA RFC-792.
  113.  
  114. This ICMP supports all options except ICMP Timestamps.
  115.  
  116. 1.2.3. Host-Host Layer
  117.  
  118. 1.2.3.1. Transmission Control Protocol (TCP)
  119.  
  120. TCP provides a reliable, sequenced "virtual circuit" or "connection-oriented" service atop IP on an end-to-end basis.  It corresponds to the Transport layer (level 4) of the OSI model.  Since a single TCP module supports multiple connections through the use of port numbers, it also provides Session (level 5) functionality without the need for a distinct layer.  (Or it makes the session layer unnecessary, depending on your point of view).  TCP is specified in ARPA RFC-793 and MIL-STD-1778.
  121.  
  122. The implementation supports an arbitrary number of simultaneous connections, limited only by memory space for control blocks.  An "upcall" mechanism is available to notify the user of three events: connection state change, receive data available and transmit buffer space available.  The Maximum Segment Size option is understood and used when it is received, and a global variable is used for generating MSS in outgoing segments.  There is currently no provision for sending URGent data.  The latest recommendations on "tinygram" avoidance (Nagle, ARPA RFC-896) are implemented and work quite well.
  123.  
  124. 1.2.3.2. User Datagram Protocol (UDP)
  125.  
  126. UDP provides only a simple, unguaranteed "datagram" or "connectionless" service, adding only checksums and port multiplexing to the raw service provided by IP.  As an alternative to TCP, UDP also sits at level 4 (and 5) of the ISORM.  UDP is specified in ARPA RFC-768.
  127.  
  128. The implementation supports the creation of queues on local sockets.  An upcall mechanism similar to that used in TCP notifies the user when datagrams have arrived.
  129.  
  130. 1.2.4. Application Layer
  131.  
  132. 1.2.4.1. File Transfer Procotol (FTP)
  133.  
  134. FTP is for transfer of binary or text files between hosts.  FTP uses two TCP connections one for exchanging commands and responses in the form of ASCII strings, and the other for the actual data transfers.  FTP is defined in ARPA RFC-959.
  135.  
  136. FTP is implemented in two parts, a server half and a client half.  The server half supports multiple simultaneous remote users, although at the moment there is no access control; anyone may access, delete or overwrite any file on the machine.  The client half is invoked by the "ftp" command.
  137.  
  138. 1.2.4.2. Remote login protocol (Telnet)
  139.  
  140. Telnet is for logging into remote systems and negotiating various options, such as remote vs local echoing.  Telnet itself is documented in ARPA RFC-854, with the many options defined in other RFCs.
  141.  
  142. The client half supports the ECHO and TRANSMIT-BINARY options; it is invoked by the "telnet" command.  A telnet "server" has been written, but since MS-DOS isn't a timesharing system it is used for keyboard-to-keyboard conversations instead.  An incoming connect request to the local Telnet port creates a local Telnet session and notifies the local user.  He may then select the new session and carry out a conversation with the remote initiator.
  143.  
  144. 1.2.4.3. Simple Mail Transfer Protocol (SMTP)
  145.  
  146. As the name implies, is used for the transfer of electronic mail between hosts.  SMTP commands and responses are strings of ASCII characters resembling those used by FTP.  SMTP uses a single TCP connection for both control and the actual mail messages.  SMTP is described in ARPA RFC-821; headers in mail messages are described in RFC-822.
  147.  
  148. A simple version server (receiver) is implemented; it accepts mail from a remote sender and appends it to a mailbox.  Mail forwarding, which accounts for much of the complexity in other mail servers, is not implemented.  A mail client ("user agent") for composing and sending messages developed by Bdale Garbee, N3EUA, and others is included.  It is called 'BM', and is documented elsewhere.
  149.  
  150. 1.2.5. Session control
  151.  
  152. The user may manage several simultaneous Telnet and FTP client invocations.  Only one client session is "active" at any one time, but the user may quickly switch between them.  Terminal output arriving for an inactive session is held until that session is again made active.  (Note that this is in addition to the multiple server sessions which go on automatically "in the background", i.e., without operator intervention).
  153.  
  154. The Internet package has been tested with and works under DoubleDos 4.0 by SoftLogic Solutions, allowing the system to be simultaneously "on the net" while executing conventional MS-DOS commands.  The net program uses the special DoubleDos function call 0EEH to relinquish the processor when it isn't needed; this speeds up the task running in the other partition.  This function is a "no-op" when DoubleDos isn't active.
  155.  
  156. 2. Administrivia
  157.  
  158. 2.1. What an "IP Address" is and How to Get One
  159.  
  160. IP Addresses are 32 bit numbers that uniquely identify a given machine (or "host") running the TCP/IP protocol suite.  All of the possible 32 bit numbers are coordinated by an entity known as the Network Information Center, or NIC.  Amateur Radio operators are fortunate in that a "Class A Subnet" consisting of 24 bits of address, in the range 44.X.X.X, has been reserved for our use.  Brian Kantor, WB6CYT of San Diego, CA, now serves as the top level administrator of the 44.X.X.X address space, and assigns blocks of addresses to regional coordinators from around the world.
  161.  
  162. You need to have a unique address before you can link in with the rest of the networked world.
  163.  
  164. <insert info on how to get address>
  165.  
  166. 2.2. Obtaining Software Updates
  167.  
  168. The KA9Q Internet software package is still evolving and growing.  As a result, we occasionally issue updates to the software that fix bugs and/or update functionality.  Announcements are always made to the USENET news group rec.ham-radio.packet, and in the bulletins on N3EUA's telephone BBS system.  They usually also show up on Compuserve within a day or two.  There is never any charge for the software.  A small charge may exist for copying floppies if you want the bits on disk, and of course you'll have to pay the long distance if you grab the bits over the phone!
  169.  
  170. If several people are running the software in your area, get together and decide on one person to get the new bits, then copy it around.  We won't mind.
  171.  
  172. 2.2.1. From N3EUA's Phone BBS
  173.  
  174. The HIP Shack phone BBS, running Opus software, is reachable as Fidonet node 128/19, 303/495-2061.  The BBS supports 300, 1200 and 2400 baud, is up 24hrs/day, and is configured to allow first-time users more than sufficient time to download the entire package in one phone call at 1200 baud.
  175.  
  176. The BBS is always the first place that the software is available.  Beta-release executables for the PC can also occasionally be found here.  You download and use these at your own risk! (Known as the "you get what you pay for" principle).
  177.  
  178. 2.2.2. From N3EUA's Unix Machine
  179.  
  180. For those running Unix machines with UUCP capability, there is an anonymous UUCP login on winfree, N3EUA's BSD Unix machine, that can be used to download the software.  This machine is up 24hrs/day, but only has one modem, and the modem stays fairly busy.  A typical L.sys entry might be:
  181.  
  182.  winfree Any ACU 2400 1-303-495-0492 ogin: Uanon word: notFTP
  183.  
  184. Start by transferring the file /usr/spool/uucppublic/pub/README for a list of the files available, and current release notes.
  185.  
  186. 2.2.3. Via FTP on the Internet
  187.  
  188. The current revision of the software is available on SIMTEL20.ARPA within a few days of each release.  The files usually reside in the directory PD1:<MISC.KA9Q-TCPIP>.  Questions on the files on Simtel20 can be directed to W8SDZ@SIMTEL20.ARPA.  Anonymous FTP's are allowed.
  189.  
  190. Beta-releases are often available on the machine LOUIE.UDEL.EDU, in the directory tree rooted at pub/ka9q.  Anonymous FTP's are allowed, but unless you're working on the software, the bits on louie can be "dangerous", as they often include incompletely implemented features, and can have serious bugs.  Caveat Emptor.
  191.  
  192. 2.2.4. On PC Floppies
  193.  
  194. The Tucson Amateur Packet Radio association (TAPR) now provides floppy copies of the software on 360k PC floppies, and can provide KISS ROMs for various TNC's, at a nominal charge for duplication and shipping.  Contact TAPR for more information.
  195.  
  196. 2.2.5. On Native Media for Other Machines
  197.  
  198. Copies of the software for the Macintosh and Amiga are best obtained by downloading from an on-line source, or by copying a friend's disk.  If all else fails, Mikel Matthews (the author of the Mac/Amiga port) is willing to make a small number of copies on native media for the Mac and/or Amiga.  Mikel can be reached via UUCP mail at ...uiucdcs!addamax!mikel.
  199.  
  200. 3. Installation of the Software
  201.  
  202. Installing the KA9Q Internet Package on your computer is not very hard, but if you haven't tried to do it before, it can be a bit confusing.  The greatest efforts made so far towards making the process simple and understandable have been made by Brian Lloyd, WB6RQN.  Much of this installation section is a direct copy of portions of his  HOWTO.DOC document.  Information about installation on machines other than the  IBM clone family has come from various sources.
  203.  
  204. 3.1. Configuring Your TNC for Network Operation
  205.  
  206. If you are using this software in a University or other wired-network environment, you may want to skip past the TNC installation section.  All Hams should keep reading!
  207.  
  208. There are now several choices for TNCs to be used with the TCP/IP network code.  Versions of the Keep It Simple Stupid TNC interface software (KISS) are available for the TNC-1, the TNC-2, the VADCG board and clones (Ashby), the Kantronics family of TNCs, and the AEA TNCs.  Following are the different setup/configuration modes for the different TNCs.
  209.  
  210. 3.1.1. TNC-1 or Heath HD-4040
  211.  
  212. The firmware for the TNC-1 is available in either a downloadable version or a stand alone version.  I will describe only the stand alone version here.  Locate the ROM labeled E000 and remove it.  Insert the KISS PROM in its place making sure that you orient the prom in the same direction (failure to do so will result in smoked PROM).  Connect your TNC-1 to your computer using an RS-232 cable.  A cable that passes the signals from pins 2, 3, and 7 is sufficient
  213.  
  214. Since the TNC-1 has no switches for setting the baud rate to the computer the firmware has been "hard wired" to 4800 baud.  See the documentation that comes with the TNC-1 version of KISS for instructions on how to patch the .HEX file for other baud rates.
  215.  
  216. 3.1.2. TNC-2 and Clones
  217.  
  218. First step is to prepare your TNC-2 for use with TCP/IP.  The standard firmware for the TNC-2 is not very computer friendly and, as such, is not very useful when it comes time to make your computer speak with other computers.  To that end Mike Chepponis, K3MC, wrote the KISS (Keep It Simple Stupid) TNC code.  There are two ROM versions for the TNC-2.  The first is contained in a type 2764 or 27C64 EPROM.  This version contains the KISS code in it.  The second version is contained in a type 27256 or 27C256 EPROM and contains both the standard TAPR 1.1.3 TNC code and a loader that will permit you to download the KISS code into the TNC.  Check the EPROM you have received and determine which type you have.  If you are burning your own EPROMs you probably do not need these instructions.
  219.  
  220. Open up your TNC and locate the ROM.  It is in the socket labeled "U23." Using a small nail file or screwdriver gently pry up the existing EPROM.  Carefully press the new EPROM into place being sure that the orientation is the same.  If you are installing the 2764 type of EPROM you will need to make a small modification to the TNC.  There is a location on the board just above the first RAM socket labeled JMP-6.  Turn the board over and cut the trace joining the two pads.  Solder a two-pin jumper header in place.  When using a type 2764 the jumper at JMP-6 should be removed and installed when a type 27256 EPROM is being used.  That  should complete the hardware part of the installation.  As an alternative you may  choose to burn the KISS code into a 27256 and not bother with jumpers.
  221.  
  222. Attach your TNC to your PC using an RS-232C cable.  You can use the same cable that you were using to connect your PC to your TNC.  If you are doing this for the first time and are not sure about your cabling, a cable with just pins 2, 3, and 7 passed through is sufficient.  Some PCs like to see the signals Clear To Send (CTS, pin 5), Data Set Ready (DSR, pin 6), and Data Carrier Detect (DCD, pin 8) asserted.  You can set this up by jumpering pin 4 to 5, and pin 20 to pins 6 and 8 at the female DB-25 connector that goes to the PC.
  223.  
  224. Now to verify that the TNC still works.  Apply power to the TNC and turn it on.  The STA, CON, and PWR LEDs should come on and the STA and CON lights should go out again about 1 second later.  If you have the type 2764 EPROM with the KISS code in it one or both of the STA and CON LEDs will begin to flash.  If the CON LED flashes you have 8Kb of RAM in the TNC.  If the STA LED flashes you have 16Kb of RAM.  If both LEDs flash you have 32 Kb of RAM.  The flashing of the LEDs verifies the proper operation of the TNC.
  225.  
  226. If you got the combined loader and TAPR version EPROM, checkout is a slightly different process.  You can test your TNC-2 using two methods.  The first method is to connect your TNC to a terminal program and send the character 'h' or 'H' to the TNC.  The result should be the standard TNC startup message.  Exit from the 1.1.3 mode of operation by issuing the reset command to the TNC.  The second method involves downloading the KISS code to the TNC.  Use the mode command to set the baud rate of the comm port to the proper value, e.g.  it matches the DIP switch setting on the back of the TNC, and copy the file tnc2kiss.hex to the appropriate comm port.  The following command sequence will serve to download the KISS code to the TNC:
  227.  
  228. mode com1:4800
  229. copy tnc2kiss.hex com1:
  230.  
  231. If the download was successful (it takes about one minute) the STA and/or CON LEDs will begin flashing as described in the previous paragraph.  If the download is not successful check the cable from computer to TNC, check the baud rate on the TNC, and check to ensure that the computer is indeed sending data to the TNC.  Once this is done the TNC is ready to use with the NET program.
  232.  
  233. NOTE:    Running KISS causes the stored parameters in the TNC, i.e.  MYCALL, NEWMODE, TXDELAY, etc., to be destroyed.  Every time you shift from KISS to TAPR modes you MUST reset the parameters.
  234.  
  235.  
  236. 3.1.3. AEA PK-232, PK-87, or new Heath TNC (PK-232 clone)
  237.  
  238. If you have one of these boxes, congratulations! You do not have to change PROMS! KISS is already installed as a standard feature if you have a recent release of the firmware, 4-MAR-87 or later for the PK-232, or 21-JAN-87 or later for the PK-87, you have KISS in your TNC already.  To make it work first ensure that your computer can communicate with the TNC in standard packet mode.  This will ensure that the  computer, TNC, cabling, and radio are all operating properly.
  239.  
  240. [Please note that one of the commands ("PACKET") is not valid on the PK-87 and will only elicit a "Huh?" response.  Please note that comments have been added to the commands.  Do not type the information following the double dash or type the double dash itself.]
  241.  
  242. Here is the sequence of commands that will turn on the KISS mode for the AEA products:
  243.  
  244. AWLEN 8    -- ensure it can speak 8 bit data
  245. PARITY 0    -- no parity
  246. RESTART    -- warm reset; make the previous commands take effect
  247. PACKET    -- PK-232 or Heath only
  248. TONE 3    -- PK-87 only
  249. START 0    -- start, stop, Xon, Xoff, Xflow to disable software flow cont.
  250. STOP 0
  251. XON 0
  252. XOFF 0
  253. XFLOW off
  254. CONMODE trans    -- pass through all characters
  255. HPOLL off    -- disable host polling
  256. KISS on    -- enable KISS version of host mode
  257. RAWHDLC on    -- turn off AX25L2 (the protocol is now handled by the PC)
  258. PPERSIST on    -- turn off DWAIT and enable p-persistence
  259. HOST on    -- start KISS running
  260.  
  261. The PK-87 or the PK-232 will remain in the KISS mode until you send a break (~200ms of spacing) or until you send the command character three times (^C ^C ^C) in quick succession.  Beware! Some terminal emulators (like YAPP) will send a break signal when you exit from them.  That will undo your work and cause all manner of confusion.  The terminal program PROCOMM seems to work just fine.  The TNC may also be switched back to ordinary AX.25 mode by issuing the following command from within NET.EXE:
  262.  
  263. param ax0 255
  264.  
  265.  
  266.  
  267. 3.1.4. Kantronics
  268.  
  269. Kantronics has recently begun to offer KISS on their products.  It is the simplest of the commercial implementations of KISS to configure and use.
  270.  
  271. First setup and operate your KAM, KPC-II, or KPC-4 for standard packet operation.  This will ensure that the computer, TNC, cabling, and radio are operating properly.  Use your terminal program to send the following commands:
  272.  
  273. ABAUD 4800    --    set the baud rate to whatever you will be using when net is running (set by the attach command)
  274. DWAIT 0    --    disable DWAIT
  275. PERSIST 50    --    enable persistence and set it to about 20%
  276. SLOTTIME 16    --    set the slot time to 160 ms
  277. KISS ON    --    Enable KISS mode at the next reset
  278. PERM    --    make the above command permanent so that KISS will be entered whenever the TNC is powered up
  279. RESET    --    start KISS
  280.  
  281. If you wish to have the the TNC revert back to ordinary AX.25 mode of operation you should omit the PERM command from the above sequence.  That way the TNC will revert back to ordinary AX.25 mode when the power is removed and restored to the TNC.  The TNC may be switched back to ordinary AX.25 mode by issuing the command:
  282.  
  283. param ax0 255
  284.  
  285. This command will work even if the PERM command has been used to make KISS the default mode of operation.
  286.  
  287. 3.2. Installation of NET.EXE on an IBM PC or Clone
  288.  
  289. Create a directory called EXE and set that as the default directory.  Use PKXARC to extract the files from EXE.ARC into the new directory.  Should you not have PKXARC already, run the program PKX35A35.EXE provided with the distribution.  This program will create the extraction utility and its documentation.
  290.  
  291. There are two programs that make up the network software: NET.EXE (the networking code) and BM.EXE (the mail program).  Copy these programs from the EXE directory to the place on your hard disk where you keep command programs.  If you are running on a floppy based system you should create a bootable floppy and copy these programs to the floppy.
  292.  
  293. Test to make sure that everything is there by executing the programs.  Type the command "net" and, if the installation of the network code was successful, the message "KA9Q internet protocol package" and the prompt "net>" will appear on the screen.  This means that the network code is running and awaiting commands.
  294.  
  295. Exit from the net code with the command "exit." Now run the command "bm." The screen should display the message "Bdale's Messy-DOS Mailer" and the prompt "Brian"> will appear (this prompt or something like it is a function of the content of the bm.rc configuration file).  If all this has occurred, all is well so far.  If you do not get this response from bm, do not be concerned.  Try again after you have configured bm in the following steps.
  296.  
  297. 3.2.1. Installing the Mail Directories used by BM
  298.  
  299. First step is to configure the mailer (BM).  To make BM work properly you must create the following directories on your disk:
  300.  
  301. //spool
  302. //spool//mail
  303. //spool//mqueue
  304.  
  305. Copy the file SEQUENCE.SEQ to the /spool/mqueue directory.  Copy the files HOSTS.NET and BM.RC to the root directory of the default drive used when net is running.  If you are on a floppy based system you need to put BM.RC with NET.EXE, BM.EXE, AUTOEXEC.NET, HOSTS.NET, and AUTOEXEC.BAT in  the root (/) directory (more on AUTOEXEC.NET later).
  306.  
  307. 3.2.2. HOST.NET
  308.  
  309. You will need to edit the file HOSTS.NET to know about all the systems with which you will exchange mail.  This is how net will translate the name into the IP address.  Here is an example of some of the entries I have in my machine for other local TCP/IP stations:
  310.  
  311. 44.96.0.2    wb2sef.ampr
  312. 44.96.0.16    n8fjb.ampr
  313. 44.96.0.17    ka3lyq.ampr Roel
  314.  
  315. All this does is translate the symbolic name to the IP address, e.g.  WB2SEF gets translated to 44.96.0.2 so that IP can route it to the proper network node.  This saves you from having to remember lots of numbers.  You may note that the last entry has two aliases, either of which may be used to specify the IP address 44.96.0.17.  There is essentially no limit to the number of aliases that may be listed for a single IP address.  Just be sure that they are all on one line.
  316.  
  317. 3.2.3. BM.RC
  318.  
  319. Next edit the file BM.RC.  This file lets the mail system know about local host name, user name, and editor name.  Here are some example entries:
  320.  
  321. host wb6rqn.ampr
  322. user brian
  323. edit emacs
  324.  
  325. The edit entry should contain the name of your favorite editor, such as edlin (edlin is not your favorite editor?).  This editor will be used to construct a mail message when you invoke that function of bm.  You may use any DOS compatible editor just so long as it has the capability to prepare ascii files (be careful if you specify a word processor -some word processors embed special characters in the file).
  326.  
  327. Later on you can read the documents BM.DOC and SMTP.DOC to get more information.  You at least have enough info to get your mailer running now.
  328.  
  329. 3.2.4. FTPUSERS
  330.  
  331. Now you need to possibly modify the /FTPUSERS file to permit users to send and receive files from your system.  The FTPUSERS file contains the information about users in the following format:
  332.  
  333. user password /directory permission-code
  334.  
  335. The 'user' entry is the user's name, 'password' is the password for that user, '/directory' is the directory to which the user will have access (all of the subdirectories too), and permission-code is a number between 0 and 7 that defines what the user may do.
  336.  
  337. The permission-code is a bit-map where the three least significant bits each have a specific meaning.  Here is a table:
  338.  
  339. 1 -read and directory access
  340. 2 - create access
  341. 4 - overwrite and delete access
  342.  
  343. The protection bits are added together to create the permission-code.  For example 3 (1+2) permit the user to read files and create new files but not overwrite or delete and existing file.  A permission-code of 7 (1+2+4) would permit full access.  Here are some examples:
  344.  
  345. guest * /public 3
  346. brian xyzzy / 7
  347.  
  348. In these examples guest may log in with any password and may copy files or create new files in the directory /public while user brian must log in with password xyzzy but will be granted full access, e.g.  read, write, overwrite, and delete, to all files in the system.
  349.  
  350. If you are running in a radio-based environment I would not give out the latter user/password combination because it will give anyone access to your entire disk.  Also remember that the user/password combination are broadcast in-the-clear for anyone to read (if they have trace turned on).  It is wise to segregate your radio-link users in a separate directory tree and not permit delete or overwrite access.  That should prevent malicious mischief.
  351.  
  352. 3.2.5. Configuring NET and the AUTOEXEC.NET file
  353.  
  354. Now you need to configure and run NET.  Configuring NET to run may be performed manually every time you start up NET.EXE but that gets old pretty fast.  There are usually many commands that must be typed the same way every time net is started.  Fortunately Phil thought of this and provided the AUTOEXEC.NET file.  The intention here is to place all the commands that you always execute in a file to be read and executed by NET.EXE whenever you start up.  To this end you will want to edit the file AUTOEXEC.NET prior to running NET.EXE.  Just use a text editor to enter the commands into the file AUTOEXEC.NET as you would type them at the "net>" prompt.
  355.  
  356. 3.2.5.1. Setting the IP address
  357.  
  358. When NET.EXE first starts up you need to tell it about many things, i.e what comm ports you have, what your IP address is, what your host name is, what other systems you will communicate with, what services you wish to provide, etc.  The first thing to do is to tell net who we are with the ip address, hostname, and ax25 mycall commands.  Enter your ip address in dotted decimal notation or give the symbolic name from your HOSTS.NET file.  Here is an example:
  359.  
  360. ip address [44.96.0.1]
  361.  
  362. The selection of an address is very important.  If you are going to be part of a network you must have a unique address.  Talk to the person in your area who is responsible for coordinating addresses.  If you are not a part of the Internet and are just using this with your own computers, pick any unique address that suits you.
  363.  
  364. NOTE:    Throughout this document names and IP addresses are interchangeable.  Net differentiates between the two by requiring you to enclose IP addresses in square brackets [].
  365.  
  366. 3.2.5.2. Hostname
  367.  
  368. The hostname command is used to set the name of your system.  This is displayed when someone initiates an FTP session with your system.  Again here is an example:
  369.  
  370. hostname wb6rqn.ampr
  371.  
  372. This corresponds to my system in my local domain.  For the purposes of amateur packet radio your call sign followed by "ampr" (amateur packet radio network) is probably sufficient.
  373.  
  374. 3.2.5.3. AX25 Mycall (packet radio only)
  375.  
  376. Since I also run net on the air (amateur packet radio networking) I must specify my amateur call sign with the ax25 mycall command.  Again, here is the entry from my AUTOEXEC.NET file:
  377.  
  378. ax25 mycall WB6RQN-0
  379.  
  380. The call sign is entered in the same form that is used with the standard TAPR TNC software, e.g.  the call sign is followed by the SSID field.
  381.  
  382. If you are going to run TCP/IP on the air using the ax25 driver (described below with the attach command) the ax25 mycall entry MUST precede the first attach command that uses the ax25 driver.  Otherwise there is no required order for these commands.
  383.  
  384. 3.2.5.4. Attach command
  385.  
  386. The attach command tells net about your comm ports and in what mode the ports will operate.  Currently four types of comm hardware are supported: standard PC async comm adapters, the HAPN TNC board for the PC, the Eagle RS-232/2 card, and the 3Com Ethernet controller.  Each of these devices has its own version of the attach command.  Here is the attach command for an async adapter card acting as COM1:.  You would use this to attach your pc to a TNC running the KISS code:
  387.  
  388. attach asy 0x3f8 4 ax25 ax0 1024 256 4800
  389.  
  390. This means attach an asynchronous adapter whose port address is 3F8 hex using interrupt line 4 (both standard for com1:), as an ax25 device (KISS TNC), using a buffer size of 1024 and a maximum transmission unit (the largest packet you are allowed to send) of 256 bytes, running at 4800 baud.  The media name for this device will be ax0, a name that will be used in the route, connect, and param commands to refer to this comm port.  This is probably a pretty good place to start.  If you also wish to use COM2 instead of or in addition to COM1 you would add the line:
  391.  
  392. attach asy 0x2f8 3 ax25 ax1 1024 256 4800
  393.  
  394. If you are instead going to use COM2 to connect with another PC using a hard wired connection (some of us do have multiple PC's) you might want to use COM2: to connect to the other PC.  We would want to use SLIP to do this so the attach command would be:
  395.  
  396. attach asy 0x2f8 3 slip sl0 1024 576 4800
  397.  
  398. NOTE:    IBM-PCs and clones all use I/O port address 0x3f8 and interrupt request line 4 for COM1 and port address 0x2f8 and interrupt request line 3 for COM2.  There are other comm cards that implement COM3, COM4, etc., but these cards may use non-standard port addresses and interrupt request lines for these ports.  Check the documentation that came with your comm card if you are trying to use COM3 or higher.
  399.  
  400. If you have an HAPN TNC card for your PC you will want to enter the following attach command:
  401.  
  402. attach hapn 0x3f8 4 ax25 h0 1024 256 csma
  403.  
  404. This tells net to use an HAPN board with the port address 3F8h and interrupt request line 4.  The speed of the board is determined by the board so the software has no control over that function.  The last parameter, listed as operation.
  405.  
  406. Recently the Eagle RS-232/2 card has become available at very reasonable prices.  This two-channel card generates HDLC frames directly and may be connected to a modem for direct packet radio operation without a TNC.  Normally it would be connected to a Bell-202-type half-duplex asynchronous modem.
  407.  
  408. The attach command for the Eagle board is almost identical to that of the standard async comm card.  Here is an example:
  409.  
  410. attach eagle 0x300 5 ax25 eg0 2048 256 1200
  411.  
  412. Two items must be as shown in the example: the mode must always be ax25 (not SLIP) and the media name must begin with 'eg' and end with a single digit.  The first Eagle card must be called eg0 and the second must be called eg1.
  413.  
  414. The Eagle card is hard wired for a base address of 0x300 and IRQ5.  The use of IRQ5 conflicts with the disk controller on the PC/XT (no problem with the PC/AT).  If you wish to use the Eagle card with a PC/XT or compatible you will need to locate the trace from pin 3 of the 74LS125 (U12) to B23 (IRQ5) on the edge connector.  Cut this trace at the edge connector and reroute it to B4 (IRQ2) on the edge connector.  This will eliminate the conflict and allow you to use IRQ2.
  415.  
  416. If you happen to have more than one PC you may wish to connect them using an Ethernet.  The net software supports the 3Com 3C500 or 3C501 boards for the PC.  The command to attach this board is:
  417.  
  418. attach 3c500 0x300 3 arpa ec0 5 1500
  419.  
  420. This tells net that there is a 3Com 3C500 board at I/O address 300h using interrupt request line 3 with the media name ec0.  Net should reserve five buffers and the largest Ethernet packet may be 1500 bytes long.
  421.  
  422. A word about the selection of the value for the maximum transmission unit.  For standard TNCs and radios 256 is probably the largest value you should use.  This ensures compatibility with the rest of the AX.25 community and ensures that you are legal if you are operating unattended (part 97 of the FCC regulations specifically mentions the AX.25 protocol in permitting unattended digital operation above 50 MHz).  The smallest value you may use is 64.  Performance improves with larger values IF you can get them to the other end without errors.  I suggest you stick with 256 until you can run some experiments of your own.  If you have a good transmission path and all the stations and gateways are attended, feel free to use larger values.  It will result in improved performance (see the discussion of the mss and window parameters).
  423.  
  424. 3.2.5.5. Param command
  425.  
  426. If you are using a TNC running the KISS code (you probably are if you are operating amateur packet radio) you will need to set the parameters in the TNC.  This is accomplished with the param command.
  427.  
  428. There are five setable parameters in the kiss code.  They are:
  429.  
  430. 1.    Transmitter keyup delay (TXD).  This is how long the TNC will wait after keying the transmitter prior to beginning to send data.  The proper value for this parameter is dependent on your configuration.  This value is in 10's of milliseconds.  Acceptable values range from 0 (0 ms) to 255 (2,550 ms or 2.55 seconds).
  431.  
  432. 2.    Persistence (p).  This is the probability that the TNC will key your transmitter if a slot is found empty (the channel is free).  Acceptable values range from 0 (p = (0+1)/256 = 0.4%) to 255 (p = 255+1/256 = 100%).  The default value is 63 (25%).  The optimum value is somewhere close to 1/n where n is the number of users on the channel.
  433.  
  434. 3.    Slot time (ts).  This is how long that the TNC will wait between samples of the channel.  Acceptable values range from 0 (0 ms) to 255 (2,550 ms or 2.55 seconds).
  435.  
  436. 4.    Tail timer (tt).  This is how long the TNC will keep the transmitter keyed after the last character has been transferred to the HDLC controller.  This has become an outdated command since most of the TNCs now set this value automatically based on data rate.
  437.  
  438. 5.    Full Duplex.  A zero value (the default value) means operate the TNC in half-duplex CSMA mode (listen before you transmit).  A non-zero value means transmit whenever there is data to send.
  439.  
  440. Let us assume that on the channel associated with ax0 that I have a radio that
  441. requires a transmit keyup delay of 200 ms, I want persistence to be 20%
  442. (p=0.2), and I want the slot time to be 160 ms.  These are the values that we
  443. use in the DC area and make us "good neighbors" who do not "hog" the channel.
  444. I would enter the following commands:
  445.  
  446. param ax0 1 20
  447. param ax0 2 51
  448. param ax0 3 16
  449.  
  450. Note that the parameters are now specified as decimal values.
  451.  
  452. NOTE:    The 'param' command will be used for issuing other device dependent commands as the need arises.  Right now it is used only for setting the parameters for kiss TNCs and the speed of SLIP and AX25 links.  Other versions of the 'param' command will be added as the need arises.
  453.  
  454. If you are dealing with a SLIP link (you used the entry slip instead of ax25 in the attach command) the param command is used to change the speed (baud rate) for the line.  If you wanted to change the speed of your second slip link to 4800 baud you would enter:
  455.  
  456. param sl1 4800
  457.  
  458.  
  459. 3.2.5.6. ax25 digipeat command (packet radio only)
  460.  
  461. If you are currently an active digipeater in your area you can also make your system continue to be a digipeater for those poor souls unlucky enough to still be running ordinary AX.25.  The command for this is:
  462.  
  463. ax25 digipeat on
  464.  
  465.  
  466. 3.2.5.7. Mail Gateway
  467.  
  468. The mail subsystem (SMTP) needs to know where to send mail should the destination be unknown to the sending system.  This is handled by the gateway command as follows:
  469.  
  470. smtp gateway wa3pxx
  471. - or -
  472. smtp gateway [44.96.0.13]
  473.  
  474. Should you try to send mail to a host that is not in your HOSTS.NET file the mailer will route the mail to the system specified in the gateway entry.  This presumes that the gateway system is smart enough to figure out to whom the mail is addressed so that the mail can be forwarded.  At this time the mailer in NET.EXE is not "smart" enough to act as a mail forwarding node.  This field is only here should you be lucky enough to have another computer accessible to you with a smart SMTP mailer or another host that acts as a gateway to another network.  Any UNIX 4.2 or 4.3 BSD system has such a mailer.  A PC running the WA3PXX BBS gateway also will serve.
  475.  
  476. For packet radio enthusiasts another use for the gateway command is to send mail on to your local BBS gateway station.  Bob Gibson, WA3PXX, has constructed a gateway program that will permit the transfer of mail from the WA7MBL BBS to SMPT and back again.  By having your local BBS run DoubleDos with the WA7MBL BBS in one partition and NET in the other you can automatically move mail between the two domains.
  477.  
  478. 3.2.5.8. Construction of Routing Tables
  479.  
  480. Now you need to construct the routing table.  This table is used by the IP to determine how to forward your packets.  Each entry consists of two or three parts, the IP address of the destination, the link upon which it is to be forwarded, and the IP address of the next station in line if there can be more than one IP address on the link (used if the mode is ax25 and not used if the mode is slip).  Here are three sample entries, one for a station more than one hop away via ax25 to be forwarded by 44.96.0.7, one for station one hop away on ax25, and one for a station on the other side of a slip link:
  481.  
  482. route add [44.96.0.5] ax0 [44.96.0.7]
  483. route add [44.96.0.2] ax0
  484. route add [44.96.0.12] sl0
  485. route add n3ja ax0
  486.  
  487. The first string following the command 'route add' is the destination IP address.  The second field, i.e.  ax0 or sl0, is the media and must match up with one of your previous attach commands.  The last field is the next station in the path if the destination is more than one hop away.  This is an optional field and only needs to be used if the media is a broadcast media such as Ethernet or AX.25 and the destination is more than one hop away.
  488.  
  489. Note that the address may be specified as either an IP address in dotted decimal notation or it may be a symbolic address from your hosts.net file.  If you choose the latter technique you must enter the symbolic address precisely as it was entered in the hosts.net file, e.g.  upper and lower case characters in the name are significant.
  490.  
  491. If you are using an Eagle RS-232/2 board your media is named eg0 or eg1.  There is still a problem because there are two ports on the board.  In order to solve this problem you will need to add the letters 'a' or 'b' to the media name.  For instance, if you have a single Eagle card your media names become 'eg0a' and 'eg0b' for the A and B ports of the card respectively.  Remember, take the media name from the attach command and append either A or B to the end of the name to select the appropriate port.  Here are some examples:
  492.  
  493. route add [44.96.0.22] eg0a
  494. route add aj9x eg0b wb3ffv
  495.  
  496. There are two other special types of route entries; the default entry and a cluster entry.  Here is a default entry:
  497.  
  498. route add default ax0 [44.96.0.99]
  499.  
  500. This means that if the address does not match any entry in your table, route the packet to 44.96.0.99 via ax0.  Hopefully the switch at 44.96.0.99 will be able to forward the packet to its destination.  This generally works well if you are merely an end node (a leaf) in the network and all your traffic goes to a single gateway.
  501.  
  502. 3.2.5.8.1.  Cluster Routing and its Associated Concepts
  503.  
  504. The other option for routing is cluster routing.  It allows you to send blocks of addresses in a certain direction.  This is useful if all the users in a given area have some common part to their IP addresses.  Here is an explanation of cluster routing and addresses in general.
  505.  
  506. The IP address is thirty-two (32) bits long.  It is generally represented as four 8-bit numbers, with each number being written in decimal form.  For example, my IP address is 44.96.0.1.  This number can be represented as the hexadecimal value 2C600001 or 00101100011000000000000000000001 in binary.  We can break this out as follows:
  507.  
  508. decimal           44        96         0         1
  509. hexadecimal       2C        60        00        01
  510. binary         00101100  01100000  00000000  00000001
  511.  
  512. Normally when you make an entry in the routing table, all bits of the address are significant, e.g.  an exact match is needed for the address to be recognized.  On the other end there is the default route in which any address matches.
  513.  
  514. Cluster routing falls somewhere between these two extremes.  Cluster routing allows you to specify how much of the address is to be considered valid.  In order to determine how many bits in the address are valid you enter the address in a special format:
  515.  
  516. route add [44.96.0.64]/26 ax0
  517.  
  518. This means that only the first 26 bits of the address are to be considered significant.  This is a form of wild card for the address.  Here is that address in binary to show the mapping:
  519.  
  520. 00101100  01100000  00000000  01??????
  521.  
  522. The question marks in the above address show the least significant six bits being "wild," or matching any corresponding bits in the address.  Here are some examples:
  523.  
  524.         44.96.0.67     00101100  01100000  00000000  01000111  (a match)
  525.         44.96.0.89     00101100  01100000  00000000  01011001  (a match)
  526.         44.96.0.01     00101100  01100000  00000000  00000001  (no match)
  527.  
  528. This works because the routing process in the net code will, when presented with an address, search for an exactly matching entry.  Failing to find that it will then look for an address that matches on the most significant 31 bits, then 30 bits, and so on.  If presented with the address 44.96.0.67 IP would, after 6 tries, match the address to the example given above.
  529.  
  530. By judiciously assigning addresses we can make the address aid us in routing the packets.  The users within a LAN should have something in common in the high order part of the address so that we can use a single entry in the routing table to make things go in the proper direction.  Here in the Washington DC area all addresses begin with 44.96.0.  This identifies this general area and may be used to provide routing to us.  Once the packet arrives in our general area cluster routing is then used to further route the packets to the appropriate area.  In DC and the parts of Maryland immediately surrounding DC the low order byte ranges from 0 to 63.  Northern Virginia users get numbers in the range of 64 to 127.  The Baltimore users get 128 to 191 while the Harrisburg, PA, users get 192 to 255.  The idea being that we can use the top two bits in the low order byte of the address to identify LANs within the address.  That way the bits in the high order part of the address will get you into the general area, the next part of the address will get you to the proper LAN, and the least significant bits will get you to the proper host or user.
  531.  
  532. 3.2.5.9. Routing Loops and the Time Too Live (TTL) Command
  533.  
  534. It is quite possible (and likely!) to make errors when setting up routing tables that will cause a routing loop to occur (a routing loop is a circular path that never reaches the intended destination).  Imagine what would happen if two stations had their default routing pointing at each other like this:
  535.  
  536. host 1 (44.96.0.1): route add default ax0 [44.96.0.2]
  537. host 2 (44.96.0.2); route add default ax0 [44.96.0.1]
  538.  
  539. In this case a packet that got routed using the default route would bounce back and forth between the two stations forever.  There is a command that can prevent this from going on forever: the Time-To-Live (ttl) command.  Every IP packet has a ttl field in it that is decremented by 1 at every hop.  When the ttl field reaches zero and the packet is not at the destination the packet is discarded and an ICMP message explaining the fact is sent to the sending host.  Normally net sets the ttl field to 255.  If you know that no host is more than 5 hops away you might issue the following command:
  540.  
  541. ip ttl 5
  542.  
  543. This means that all packets from your host/station are sent with ttl set to an initial value of 5.  These packets will now be discarded if they haven't reached their destination after 5 hops.  This limits the traffic in the network should somebody inadvertently create a routing loop.
  544.  
  545. 3.2.6. Using Digipeaters and the ARP Add Command (packet radio only)
  546.  
  547. Since there may not be many TCP users in your area you may need to use a digipeater (or two) to reach the other users in your area.  This is now possible by adding entries to the ARP (Address Resolution Protocol) tables.  ARP serves to map IP addresses into Ethernet or AX25 address, whichever is appropriate to the media in use.  ARP normally does its work automatically by directly conversing with the other station but it cannot do that if the other station is reachable only via a digipeater.  In that case you must "hard-wire" an ARP table entry with the ARP ADD command.
  548.  
  549. Before you can use the ARP ADD command you must know the path to the other station.  Let us assume that the station with whom you wish to communicate is WA4OIE (Other Internet Experimenter) whose address is 44.96.0.247, but the only path available is via WB3PID (Poor Inefficient Digipeater).  In this case you will use the following ARP ADD command:
  550.  
  551. arp add [44.96.0.247] ax25 wa4oie wb3pid
  552. - or -
  553. arp add wa4oie ax25 wa4oie wb3pid
  554.  
  555. From this point on packets sent over an AX25 link to address 44.96.0.247 will use the AX25 destination address of WA4OIE with an intermediate digipeater address of WB3PBD.  If you need to use more than one digipeater it is permissible.  Just place the call signs of the digipeaters sequentially following the destination AX.25 address.
  556.  
  557. 3.2.7. Window and Maximum Segment Sizes
  558.  
  559. The next information we want to include is some information used by TCP to determine how much data it can send at one time and how much data may be outstanding before it stops to wait for an ack from the other end.  Here are the example values:
  560.  
  561. tcp mss 216
  562. tcp window 648
  563.  
  564. The parameter mss stands for maximum segment size and represents the largest single segment that TCP will send.  Mss should be set as a function of the quality of the link over which you are running.  Relatively error-free links should use larger values of mss.  If you are running on amateur packet radio and wish to operate unattended you should probably limit this value to 216 (an mss of 216 will cause you to send AX.25 packets that are 256 bytes long.
  565.  
  566. The net program now compares the mss value and the mtu values given in the attach command for the media being used.  Since TCP and IP each have a 20 byte header (a total of 40 bytes), an mss of 216 corresponds to an mtu of 256.  If you are using mixed mtu's, i.e.  256 for AX.25, 1500 for Ethernet, and 576 for SLIP, set the mss to correspond to the largest mtu you are using and let net adjust the mss downward for the media that are using smaller values for mtu.
  567.  
  568. The 'window' parameter is how many bytes may be outstanding at any one time before you wait for an ack.  If you have a pretty good link you can increase the value of mss.  If window is larger than mss TCP will run as a sliding window protocol, e.g.  continue to send packets while waiting for ACKs on previously sent packets.  Since TCP uses selective reject (resend ONLY those segments that were damaged or lost) this is not a very expensive proposition.  In any case window should always be a multiple of mss to prevent the transmission of small packets every once in a while.
  569.  
  570. If you are running on a radio channel at 1200 baud remember that a 1024 byte transmission will take seven seconds, a time that can make you unpopular if you have to share the frequency with AX.25 TNCs that cannot adapt to the high channel utilization.  In those cases it is probably better to reduce window and/or mss values.  The above values will make you fit in reasonably with your other AX.25 neighbors.  Remember that the efficiency of large packets and long transmissions are probably not worth having your neighbors so angry that they tie a rope between your coax and the bumper of a pickup truck so that they can non-surgically remove your station from your shack.
  571.  
  572. One last point before we move on; the mss and window values that you set will be the ones that your TCP will ask the OTHER station to use.  When the session is initially set up the two TCPs will exchange mss and window values.  This permits stations to automatically adjust to the capabilities of the other station.  For this reason it is best to get everyone in your LAN to use the same values.
  573.  
  574. 3.2.8. Starting the Servers
  575.  
  576. Next you need to decide what services you will provide to other users in the network.  You must start the servers or others won't be able to make use of your system for mail or file transfers.  You will simply be a switch for other users (in fact, for a switch on a hill that may be just what you want).  You will still be able to initiate file transfers or telnet sessions but no one will be able to initiate one with you.  Should you fail to start the servers anyone trying to access those services on your machine will just receive a "Closed, (reset)" message.  For the sake of consistency you will probably want to use the start command to enable the following services:
  577.  
  578. start telnet
  579. start ftp
  580. start smtp
  581. start echo
  582. start discard
  583.  
  584. Telnet is the terminal-to-host and terminal-to-terminal mode, ftp is the file transfer protocol, smtp is the mail system (simple mail transfer protocol), and echo is the echo server (it just sends back any packets it receives -good for finding out if a switch is out there and running).  The discard server simply throws away anything it receives.  The echo and discard servers are generally used for testing a link.
  585.  
  586. 3.3. Running the network program NET.EXE
  587.  
  588. Start the networking program running by issuing the command "net." You should be rewarded by having the "net>" prompt appear on your screen.  If you prepared AUTOEXEC.NET as described in the previous section then you don't need to issue any configuration commands.  If you have not set up AUTOEXEC.NET you will want to read that section of the manual prior to proceeding with this section.
  589.  
  590. 3.3.1. Operating Modes
  591.  
  592. Net provides two modes of operation: command and session.  In the command mode you are interacting with the command interpreter to permit you to establish sessions, retrieve status information, establish new routing table entries, etc.  Please consider the commands you were required to enter in the AUTOEXEC.NET file.  All of those commands were directed at the command interpreter.  You can tell that the NET.EXE command interpreter is waiting for input because it will present this prompt:
  593.  
  594. net>
  595.  
  596. The session mode is unique to the session with which you wish to communicate.  TELNET (terminal-to-host and terminal-to-terminal) and FTP (the File Transfer Protocol) are the two types of sessions with which you may interact and each has its own sets of commands and operating modes.
  597.  
  598. Before you get too carried away with trying things it is probably a good idea to read at least as far as the discussion on multiple sessions.  That will explain how to start and use TELNET and FTP as well as how to keep straight all the activity from multiple users.
  599.  
  600. 3.3.2. Running TELNET
  601.  
  602. TELNET is used to provide terminal mode access to a host computer system but may also be used to have a terminal-to-terminal "chat" with another operator.  There are three commands directly associated with the TELNET service: the 'telnet', the 'eol', and the 'echo' commands.  ,NH 4 The 'telnet' command:
  603.  
  604. The 'telnet' command is used to establish a TELNET session with a remote TCP socket, usually the TELNET server on a remote host.  To establish a TELNET session you would issue the 'telnet' command as follows:
  605.  
  606. telnet wb2sef
  607. telnet [44.96.0.2]
  608.  
  609. Both of these commands would establish a TELNET session with the TELNET server at WB2SEF because WB2SEF is defined in HOSTS.NET as having the address 44.96.0.2.  Note that we merely specified that we wished to establish a TELNET session and the TELNET client then connected us with the TELNET server which resides at TCP port address 23.  There is an extended syntax for the 'telnet' command that will let you specify the port number at the remote host to which you wish to be connected.  Here is an example of the extended syntax:
  610.  
  611. telnet [44.96.0.2] 7
  612. telnet wb2sef 9
  613.  
  614.  
  615. In the first example TELNET is being asked to establish a session with port number 7, the echo server, at the host whose address is 44.96.0.2.  The second example also is a request to connect to the host whose address is 44.96.0.2 but this time the connection is to be made to port number 9, the discard server.  These two ports are regularly used for test purposes, the echo server echoing back everything it receives and the discard server discarding everything it receives but returning a proper acknowledgement.
  616.  
  617. Once you have issued the 'telnet' command you will see the message "SYN sent" followed a short time later by the message "Established" (assuming that your destination was reachable).  At this point you would be in communication with the TELNET server on the other end.  If the remote host is a timesharing computer (possibly running UNIX) you would very shortly be presented with a login screen.  You may consider your keyboard and screen to be directly connected to the remote computer at this point.
  618.  
  619. On the other hand maybe you were attempting to establish a connection with another computer running the net code.  In that case you would be in keyboard-to-screen communication with the operator at the remote host (assuming that he/she selected the new session as the current session; a subject that will be discussed later).  Whatever you type will appear on the other screen and vice-versa.
  620.  
  621. 3.3.2.1. The ECHO Command
  622.  
  623. In addition to the 'telnet' command there are the 'eol' and 'echo' commands.  The 'echo' command determines what the TELNET client will do if the remote host offers to echo characters (what we would consider full duplex).  Here is the command syntax:
  624.  
  625. echo accept [the default value]
  626. echo reject
  627.  
  628. If the remote host is a timesharing computer you probably want it to echo your characters back to you rather than let your local TELNET client echo the characters.  This permits you to use sophisticated screen-oriented programs without having your local echoing disrupt the screen display.  On the other hand you may prefer to reject echoing in the case of a very slow network where having what you type appear on the screen several seconds later could be very annoying.  Please note that the setting of this parameter has no effect when entering a TELNET session with another copy of NET since NET always refuses to echo characters.
  629.  
  630. 3.3.2.2. The EOL Command
  631.  
  632. The 'eol' command is also used to adjust the keyboard functionality when remote echoing has been negotiated.  It is used to select the appropriate end-of-line character to be sent when the operator presses the <ENTER> or <RETURN> key.  Here are examples of the two options:
  633.  
  634. eol standard    [the default value]
  635. eol unix
  636.  
  637. Should you set 'eol' to 'unix' and remote echoing is negotiated by the two systems, the <RETURN> or <ENTER> key will send an ASCII line feed character rather than the carriage return character.  Normally this will not be needed but some UNIX system demand this.  Should the remote host not respond to your <RETURN> key you might want to try this option.
  638.  
  639. To exit back to the command prompt from within a telnet session press the F10 key.  The 'net>' prompt will appear.  This does not close the TELNET session but merely suspends it.  Incoming data addressed to your TELNET session will be saved until you re-enter the session (see the discussion of changing sessions that follows later).
  640.  
  641. The last item of interest to the TELNET user is how to terminate a TELNET session.  That is accomplished with the 'close' command.  To close the session simply press the F10 key to return to the command prompt and enter the 'close' command.  You should be rewarded with the sequence of messages:
  642.  
  643. FIN wait 1
  644. FIN wait 2
  645. Time wait [followed by a delay period of about 30 seconds]
  646. Closed (Normal)
  647.  
  648. 3.3.3. File Transfer (FTP)
  649.  
  650. The File Transfer Protocol (FTP) permits you to send and receive both text (ASCII) and binary (image) files.  The FTP application accepts many commands that will permit you to create files, delete files, change directories, and copy files.  This section will guide you through the most used FTP commands.
  651.  
  652. 3.3.3.1. Establishing a Session
  653.  
  654. To establish an FTP session with a remote host you use the 'ftp' command.  To establish an FTP session with WB2SEF I would use one of the following commands:
  655.  
  656. ftp wb2sef
  657. ftp [44.96.0.2]
  658.  
  659. Both commands do the same thing because of the information contained in my HOSTS.NET file.  After issuing one of the above commands you would see the usual 'SYN sent' and 'Established' messages.  You would then be greeted by a message from the remote FTP server that looked something like this:
  660.  
  661. 220 wb2sef.ampr FTP version 871225.5 ready at Tue Jan 19 17:57:23 1987
  662.  
  663. This message tells you that the remote FTP is ready to accept commands from you.  FTP gives you no prompt so at this point you must understand that after issuing a  command you will be notified of the command's completion but no further prompting  for messages will occur.  One thing to note is that when FTP sends you a message it will  always be prefixed with a three-digit number.  This is for the benefit of computer  programs that may be driving the FTP system.  The number is for the benefit of the  computer and the text is for the benefit of the user.
  664.  
  665. The first thing you will need to do is to log in to the remote host with your user ID and your password.  Unless you have been given a specific user ID and password by someone at the remote host you will probably log in with the guest user ID and password.  You will send the 'user' and Here is an example:
  666.  
  667. user guest
  668. 331 Enter PASS command
  669. pass xyzzy
  670. 230 Logged in
  671.  
  672. This exchange presumes that your user ID is "guest" and that your password is "xyzzy." If the user ID does not require a password you may or may not be prompted for the password.  NET always prompts for the password whether it needs it or not.  If the remote host is running NET and has in its FTPUSERS file an entry that uses an asterisk (*) for the password, any password will be accepted.
  673.  
  674. If you enter either an invalid user ID or an invalid password the remote FTP will return the following message:
  675.  
  676. 550 Permission denied
  677.  
  678. Simply reenter the 'user' and 'pass' commands with the proper values and you will be logged in.  You may also enter new 'user' and 'pass' commands at any time to change your user ID and hence your permissions as far as the remote host is concerned.
  679.  
  680. 3.3.4. Manipulating Directories on the Remote Host
  681.  
  682. When you log into the remote host you will be set in "your" directory (I put the word your in quotes because many people may be using that directory since many people may be allowed to log in concurrently with the same user ID).  You can get a directory listing of files within that directory with the 'dir' command (just like DOS).  What you will receive back from the remote host will be a standard DOS directory listing.  If you would prefer a short listing, e.g.  only the names of the files, you can use the 'ls' command.  Both commands will accept wild cards so the following commands are all valid:
  683.  
  684. dir
  685. ls *.*
  686. dir *.com
  687. ls test*.dat
  688.  
  689. After issuing the command you will see the following sequence of responses from the remote host:
  690.  
  691. 200 Port command okay
  692. 150 Opening data connection for LIST /public
  693. Your directory listing will be displayed here
  694. Get complete, nnnn bytes received
  695. 226 File sent OK
  696.  
  697. The end of the "150 Opening data connection ..." response will differ depending on the directory request you made.  If you used the 'dir' command you would see the word "LIST." If you used the 'ls' command you would see the word "NLST." What followed the "LIST" or "NLST" would be the name of the directory you are listing.
  698.  
  699. In addition to listing directories you can change the directory and query for the current directory.  Let us assume that for your user ID (guest) your root directory is /public.  Let us also assume that in public you would find the three subdirectories tcp, games, and utils.  When you log in your directory is set to /public.  Now you issue one of the following commands:
  700.  
  701. cd tcp
  702. cd /public/tcp
  703.  
  704. The result would be the same since you were already in directory /public.  FTP would then send you the response:
  705.  
  706. 257 "/public/tcp" is current directory
  707.  
  708. You may use the 'cd' command to change directory to any subdirectory below your home directory in the same way that the DOS cd command will also allow you change directories.
  709.  
  710. If you are not sure what directory you are in you may use the 'pwd' (print working directory) command.  If we were to issue the command:
  711.  
  712. pwd
  713.  
  714. the remote FTP would then respond:
  715.  
  716. 257 "/public/tcp" is current directory
  717.  
  718. as if you had just changed directories.
  719.  
  720. Now we get down to the meat of the matter: sending and receiving files.  Prior to doing a file transfer you need to tell FTP what type of transfer to use.  You have two choices: ASCII (text files) or Image (binary files).  To select what type of transfer, you use the
  721.  
  722. type i
  723. type a
  724.  
  725. The former will set all subsequent transfers to image mode for sending binary files.  The latter will set all subsequent transfers to ASCII mode for sending or receiving text files.  If you use the 'type' command by itself like:
  726.  
  727. type
  728.  
  729. FTP will respond with either the word "Image" or "Ascii," whichever is appropriate.  If you do not specify a type of transfer FTP will use the default value "ASCII."
  730.  
  731. Files transferred with type set to ASCII will have their newline sequence translated to that expected by the remote host.  Files transferred with type set to image will have no translation performed at all.  All bytes in the file will be transferred with no changes whatsoever.
  732.  
  733. Once you select the type of transfer you desire you may then send or receive files.  The 'put' and 'get' commands are used to send and receive files respectively.  Let us assume that I have a file on my system in my current directory called "foo" and I want to transfer it to the remote host and have it placed in my current directory there.  To do this I would use the following command:
  734.  
  735. put foo
  736.  
  737. FTP would then transfer file "foo" from the local to the remote system.  You would know the status of the transfer from the following sequence of messages:
  738.  
  739. 200 Port command okay
  740. 150 Opening data connection for STOR foo
  741. Put complete, nnn bytes sent
  742. 226 File received OK
  743.  
  744. Now let us fetch file "bar" from the remote system.  Here is your command the the responses from FTP:
  745.  
  746. get bar
  747. 200 Port command okay
  748. 150 Opening data connection for RETR bar
  749. Get complete, nnn bytes received
  750. 226 File sent OK
  751.  
  752. Now it may not be convenient to have the file retain its file name when it is copied.  Perhaps there is already a file with the same name at the destination and you do not wish to, or may not be permitted to, overwrite the file.  In that case you would add the destination file name to the get or the put command as follows:
  753.  
  754. put foo bar
  755. get /public/tcp/herfile herfile
  756.  
  757. In the first example the local file "foo" would be copied to file "bar" on the remote system.  In the second example the file "/public/tcp/herfile" would be copied to "herfile" on the remote system.  The reason for doing it this way in the second example is to avoid having FTP try to create the file "/public/tcp/herfile" on the remote end.  Perhaps there is no directory "/public" or "/public/tcp" or perhaps you are in an FTP session with a system that has completely different file naming conventions (remember that you may be communicating with systems other than PC's).
  758.  
  759. It is also possible to get a file and type it to your CRT directly.  If you want to get the file to your screen use "con" as the name of the destination file.  Here is an example that will fetch file "foo" and send it to the CRT:
  760.  
  761. get foo con
  762.  
  763. You may at some point want to terminate a transfer that is currently in progress.  The 'abort' command is used for this.  There are no parameters on the abort command.  Just type 'abort' and the current transfer will be aborted.
  764.  
  765. The last command of interest to FTP users is the dele command.  The dele command is used to delete a file on the remote system.  Here is an example that will delete the file foo on the remote system:
  766.  
  767. dele foo
  768.  
  769. Remember that in order to use the dele command you must have delete and overwrite permission on the remote system.
  770.  
  771. When done using FTP use the command 'quit.' 'Quit' will get you the following message sequence:
  772.  
  773. 221 Goodbye!
  774. Close wait
  775. Last ACK
  776. Closed (Normal)
  777.  
  778. All of this indicates that FTP has properly terminated the session and returned you to the command interpreter.  Alternatively, you can just close the session by hitting F10 and typing "close".
  779.  
  780. 3.3.5. Multiple Sessions
  781.  
  782. One of the many advantages of NET is that it permits you to establish several sessions concurrently.  For instance, you could establish an FTP session with a host and then switch back to the command interpreter so that you could start another session.  The nice thing about this is that it in no way interferes with any sessions that are already running.  Your FTP session continues to transfer data even while you enter into a TELNET session with the same or a different host.  Any screen output that arrives for a session that is not the currently selected session will be held until you again select that session.  This prevents you from losing any output while you interact with another session or with the command interpreter.
  783.  
  784. As mentioned, in order to start a new session (or issue any other type of command for that matter) you must be interacting with the command interpreter.  To get to the command prompt you need only press F10.  Once at the command prompt you can examine or select a new session using the 'session' command (abbreviated 'se').
  785.  
  786. The session command when used by itself will give you a list of all the currently open session.  Here are two examples:
  787.  
  788. session
  789. se
  790.  
  791. The result will be a display similar to the following:
  792.  
  793.  #   &CB Type     Rcv-Q State Remote socket
  794.  0  c7a8 Telnet      0  Established  w3fws:23
  795. *1  c434 FTP         0  Established  44.96.0.13:21
  796.  
  797. The first field (#) is the session number.  The asterisk (*) identifies the current session.  CB is the protocol control block associated with this session (these are explained in detail as part of the tcp status and ax25 status commands later in this document).  The Type field identifies the session as an FTP, a TELNET, or an AX.25 connected mode (TNC) session.  The state field indicates the state of the "connection" as far as this session is concerned.  A value of SYN Sent indicates that the "connection" is in the process of being constructed.  A value of Established indicates that the "connection" and therefore the session is open and ready to transfer information.  Values of FIN Wait 1, FIN Wait 2, or Time Wait indicate that the connection is being closed.  The last field, Remote Socket, identifies the host and port with whom the session was initiated.
  798.  
  799. Once you start a session it becomes your current session unless you close it or switch to another session.  To get back to a session from the 'net>' prompt all you need to do is press the <RETURN> or <ENTER> key.  If you happened to close the current session there will be no current session.  In that case pressing <RETURN> or <ENTER> will have no effect.  You will need to explicitly select a new session with the session command.
  800.  
  801. If you follow the session command with a number, the session command will make the session whose number was specified, the current session and then turn control of the keyboard and screen over to that session.  Here are two examples:
  802.  
  803. session 0
  804. se 0
  805.  
  806. Both of these examples change the current session to session 0.  At that point you will be interacting with the desired session.
  807.  
  808. As mentioned in the section on the 'telnet' command you close a session with the close command.  If the session you wish to close is not the current session you need to issue the command 'close n' where n is the number of the session you wish to close.
  809.  
  810. Last of all you may need to abort a session or an open socket.  This may occur when you have a session with another host and that host goes away for whatever reason (power failure, hardware failure, link failure, etc.).  In that case you must resort to the 'reset' command.  The without having to go through the normal closing sequence.  There are two forms.  The first is the command or 'ax25 reset' followed by the address of TCP or AX.25 control block, as appropriate.  Here are several examples:
  811.  
  812. tcp reset c7a8
  813. reset 0
  814.  
  815. Either command would force TCP to close the socket associated with the session with 44.96.0.13 and hence close that session.  It would give no indication to the other end that the socket had been closed.  The only indication that the other end would receive would be to receive a reset instead of an ACK packet the next time the remote end sent a packet of data.
  816.  
  817. 3.3.6. Status Monitoring and Other Commands
  818.  
  819. There are quite a few commands in NET.EXE.  Many of them were explained in conjunction with the installation instructions and, in fact, have little use beyond initialization.  Commands in this category include:
  820.  
  821. ip address    setting your IP address
  822. ax25 mycall    setting your AX.25 link address
  823. ip ttl    initial time-to-live field for IP packets
  824. attach    starting a driver for a particular hardware device
  825. tcp mss    setting the maximum size for a TCP segment (packet)
  826. tcp window    setting the maximum number of un-acked bytes
  827. ax25 digipeat    enable/disable AX.25 digipeating
  828. hostname    set the name for your system (used by FTP)
  829.  
  830. On the other hand there are quite a few commands that you will be using extensively.  Let's start by covering the status commands.
  831.  
  832. 3.3.6.1. Getting Status Information
  833.  
  834. 3.3.6.1.1. ip status
  835.  
  836. The first of the status commands is 'ip status' and may be abbreviated 'ip s'.  This returns information about the status of IP packets that have passed through your system: e.g.  originated, received, or passed through (switched).  The format for the ip status response looks like this:
  837.  
  838. total 973 runt 0 len err 0 vers err 0 chksum err 5 badproto 0
  839.  
  840. The 'total' field (973 in this case) identifies the number of IP datagrams that have passed through your system.  The next field, 'runt', identifies the number of packets that were below minimum acceptable size.  'Len err' identifies the number of packets with length errors.  'Vers err' identifies packets that came from a system running a version of IP that is incompatible with the one that you are running (unlikely to occur unless the Internet adopts a new standard for IP).  'Chksum err' is the number of packets that arrived with a checksum error on the IP header (these packets will be discarded because the system has no way of knowing if any of the information is valid).  'Badproto' identifies the number of packets that arrived with the protocol identifier set to an upper layer protocol (ULP) that is not either ICMP, TCP or UDP (the only three ULP's currently supported in NET.EXE).
  841.  
  842. Of all these possible errors you are likely to see only the runt, len err, and chksum err fields increment.  Version and bad protocol errors can only occur if you are communicating with a system that supports a different version or a different set of ULP's.  This is unlikely to happen.
  843.  
  844. 3.3.6.1.2. tcp status
  845.  
  846. Another often used command is the tcp status command.  tcp status returns a great deal of information on the current status of your TCP "connections." Upon entering the command 'tcp status' (abbreviated 't s') the system will print a General status on the TCP activity and an abbreviated display on the status of each TCP session.  The top line looks like this:
  847.  
  848. Conout 5 Conin 17 Reset out 2 Runt 0 Checksum err 1 bdcsts 0
  849.  
  850. at your system while 'conin' is the number of incoming "connections" that have been made with your system.  'Reset out' is the number of resets that were sent to remote systems (this would happen if a remote system attempted to send data to a socket that had been closed).  The 'Runt' field is the number of undersized packets that were received.  The 'Checksum err' field is the number of TCP segments that were discarded because the segment failed the TCP checksum check (IP checksums only the packet header while TCP applies a checksum test to the entire TCP segment including header).  The last field indicates the number of broadcast messages that have been received.
  851.  
  852. Following the header line a table is presented, one line per socket.  The headings appear as follows:
  853.  
  854. &TCB  Rcv-Q  Snd-Q   Local Socket      Remote Socket   State
  855.  
  856. f784    17      0    44.96.0.1:1001    44.96.0.2:23    Established
  857. eb30     0      0    44.96.0.1:23      0.0.0.0:0       Listen (S)
  858.  
  859. In the above example there are two open sockets.  The first, associated with the TCP Control Block (TCB) at address f784, is a TELNET (terminal-to-terminal or terminal-to-host) session with the system whose address is 44.96.0.2.  The second socket, described by the TCB at location eb30, is a passive ("server") open that exists to accept incoming TELNET connections.  Now for a more comprehensive description of the fields.
  860.  
  861. The TCB is the TCP control block.  The number, in hex, is the address of the TCB in memory and serves to identify a particular open socket.  Rcv-Q is the number of octets (8-bit things that we normally call bytes) that have been received and are waiting to be processed (this is one way to tell if you have received information from another station if you are involved in more than one TELNET or FTP session).
  862.  
  863. The next two fields, Local Socket and Remote Socket, make up the identification of the connection as far as TCP is concerned.  The first part of a socket number is the IP address.  The second part of the socket number, the part following the colon, is the port number.  There are many "standard" port numbers in use.  Here are some of the more common:
  864.  
  865. Port    Application
  866.  
  867. 7    Echo server
  868. 9    Discard server
  869. 20    FTP server data port
  870. 21    FTP server command port
  871. 23    TELNET server
  872. 25    SMTP server
  873.  
  874. You may see other port numbers used such as 1001, 1002, etc.  These are temporary ports that are used to form a unique connection (TCP identifies a connection by combining the remote and local socket address in order to guarantee uniqueness).
  875.  
  876. Since no two systems have the same network address the combination of local socket (address + port) and remote socket forms a unique combination.  This is how the TCP on both ends of a "connection" identifies that connection.
  877.  
  878. It is possible to get even more information about a specific socket by adding the TCB address to the end of the tcp status command like this:
  879.  
  880. tcb status f784
  881.  
  882. This will return the detailed TCP status information about the socket that is described by the TCB at address f784 (you get this address from the tcp status command without a parameter).  Here is the sample format:
  883.  
  884. Local: 44.96.0.1:1001 Remote: 44.96.0.2:23 State: Established
  885.       Init Seq   Unack     Next      WL1      WL2  Wind   MSS Queue   Total
  886. Send:  328b740 328b741  328b741 dffde2e1  328b741   864   216     0       0
  887. Recv: dffde2e0         dffde4e1                    1024           0     512
  888. Retry 0 Timer stopped Smoothed round trip time  5500 ms
  889.  
  890. The 'Init Seq', 'Unack', 'Next', 'WL1', and 'WL2' fields have to do with TCP's internal flow control and sequence numbering mechanisms.  Continuous monitoring of these fields gives you a good idea of the performance of the network in terms of the number of packets lost.  The 'Wind' field shows the number of bytes that the receiver is ready to accept, as of the last TCP packet received.  The 'effective window' (the number of bytes that the transmitter may send) is the 'Wind' value reduced by the number of bytes "in the pipe", that is, already sent but not yet acknowledged.  This is found by subtracting the 'Unack' value from the 'Next' value.
  891.  
  892. TCP often defers transmitting when it theoretically could, i.e., when there is data on the send queue and a non-zero effective window.  This is done when there is already data "in the pipe" but there is not enough new data to fill a maximum size packet.  In this case, TCP waits for an acknowledgment for the data already sent before sending more.  This results in a stream of a few relatively large packets instead of many small packets ("tinygrams"), for a considerable efficiency improvement.
  893.  
  894. NOTE:    A good understanding of sliding window protocols is required to make use of the information presented in these particular fields and a complete explanation is beyond the scope of this document.  See RFC-793 or MIL-1778 for more details on the specific sliding window algorithms used in TCP, and RFC-896 for the "tinygram avoidance" transmission strategy.
  895.  
  896. The 'MSS' field displays the maximum segment size; the maximum number of bytes that may be sent as a single TCP segment (packet).
  897.  
  898. Both the maximum window size and MSS are "negotiated" by the TCPs running in the two communicating system.  Essentially this means that the two ends "agree" on the best values to use for these parameters.  When you set a value for window size and a value for MSS in your machine, those values are communicated to the remote end when a socket is opened.  That allows the remote end to know how much information you are prepared to accept and to prevent the remote end from sending you too much information.  Remember, the values for window and MSS that you set on your system will be the values that the other station will use when sending to you.  Also remember that the two ends may set different values and still work effectively.
  899.  
  900. As an aside, you are permitted to change the value of MSS or WINDOW while the net program is running.  On the other hand, changing the value of MSS or WINDOW after a socket has been opened will have no effect on any currently open sockets.  Open sockets will continue to use the value for MSS that they negotiated when the socket was opened.  The changed values will be used when TCP opens a new socket.
  901.  
  902. The Queue field indicates how many bytes of data are waiting at a particular socket.  In the case of the send queue this field indicates the number of bytes transmitted but not yet acknowledged.  During SMTP and FTP sessions it is not unusual to see this value equal to the window size.  In the case of the receive queue the value indicates the number of bytes that have been received but have not been "picked-up" by the application.
  903.  
  904. The Total field indicates the number of bytes that have been received or transmitted on a socket since the socket was opened.  This information is very useful during an FTP session because it will tell you the total number of bytes transferred on the file (FTP opens a new data socket for every transfer, closing the socket when the transfer is complete).  If you know the size of the file ahead of time you can use this information to determine how much of the file has reached the receiving end -nice information to know when doing a long file transfer over a slow or unreliable link.
  905.  
  906. The next field is the retry counter.  If a segment is not acknowledged within an appropriate period TCP will retransmit that segment because it will assume that the segment was lost somewhere in the network.  Each time it retransmits a segment the 'Retry' counter is incremented.  TCP never gives up sending data.  It does 'back off' and send segments less and less frequently in order to reduce network loading.
  907.  
  908. The next field is the 'Timer' field.  It displays the status of the timer for this particular socket.  If TCP is waiting for an acknowledgement to an outstanding segment there will be a time displayed in this field.  If there are no outstanding segments the word "stopped" will indicate that the timer is not running.
  909.  
  910. The last field, 'round trip time', is a very interesting piece of information.  It is the amount of time that TCP has determined that it takes for an outgoing segment to arrive at its destination and for its acknowledgement to return.  This value is used to determine the proper setting for the retry timer thus allowing TCP to adapt to the changing conditions of the underlying network and to prevent the network from being flooded by unnecessary retransmissions.
  911.  
  912. The tcp status command is probably the most used command in the net program.  Don't be afraid of it, use it! You may not understand all the fields but you will quickly pick up what is important and what you can ignore.  Experiment with it so that you understand it better.  It is a key to pinpointing network performance problems.
  913.  
  914. 3.3.6.2. udp status
  915.  
  916. The next status command of interest is 'udp status,' used for getting status information about information that has been received for the User Datagram Protocol (UDP) ULP.  This command may be abbreviated 'u.' When an application makes use of the UDP transport service it opens a UDP socket.  The udp status command will display the status of the transport service and of each of the
  917. open sockets.  Here is an example of the output of a udp status command:
  918.  
  919. sent 51 rcvd 50 bdcsts 0 cksum err 0 Unknown Socket 9
  920. &UCB  Rcv-Q  Local Socket
  921.  
  922. ff38    293  44.96.0.1:3
  923.  
  924. In this example the 'sent' and 'rcvd' fields indicate how many UDP datagrams have been sent and received respectively.  The 'bdcsts' field identifies the number of broadcast datagrams that have been received.  The 'cksum err' field indicates how many datagrams have been received with errors while the that were addressed to unknown (unopened) sockets.
  925.  
  926. Following the general information is the specific information about all of the currently open sockets.  Each open socket is identified by the address of its UDP Control Block (&UCB).  Following that is the number of bytes that have been received and placed on the receive queue (Rcv-Q).  Last comes the actual socket identifier consisting of the IP address concatenated with the port number.
  927.  
  928. 3.3.7. AX.25 connected mode operation
  929.  
  930. In addition to the TCP/IP mode of operation this new version of NET.EXE now supports fully connected AX.25 (TNC-to-TNC) operation for talking to BBS'es and your buddies without TCP/IP.  When NET.EXE is running you are free to establish both TCP and AX.25 sessions.  When you make an AX.25 connection it will be treated like a TELNET session.  You can use the session command to switch between sessions at will.  This prevents the output from one AX.25 session from interfering with other sessions.  To make a connection you use the connect command which is very similar to the TNC's connect command with the exception of the addition of a channel identifier.  Here are some examples:
  931.  
  932. connect ax1 wa3pxx
  933. connect ax2 n4qq k3af-10
  934.  
  935. The first command starts a connection to wa3pxx directly over the channel labeled ax1 (see the attach command).  The second example establishes a connection to n4qq via the k3af-10 digipeater on channel ax2.  To disconnect you use either the disconnect command or the close command.
  936.  
  937. The other commands for AX.25 are very familiar to a user of a TNC.  Here is a list of commands and a brief description of their meanings:
  938.  
  939. ax25 digipeat [on|off]    turn digipeating on or off
  940.  
  941. ax25 maxframe [n]    set the maximum number of outstanding frames (packets) to n where n is between 1 and 7 inclusive.
  942.  
  943. ax25 mycall [<call>]    Set the call sign for AX.25 frames
  944.  
  945. ax25 paclen [n]    Set the maximum size of an AX.25 I-field
  946.  
  947. ax25 status    Display a status much like tcp status.  If you follow it with an ACB address it will display detailed info about a particular connection.
  948.  
  949. ax25 t1 [n]    Displays or sets the value of the retransmission timer (FRACK).  The value is in seconds.
  950.  
  951. ax25 t2 [n]    Displays or sets the value of the ack delay timer (RESPTIME) in seconds.
  952.  
  953. ax25 t3 [n]    Displays or sets the value of "keep alive" timer (CHECK) in seconds.
  954.  
  955. ax25 window [n]    Displays or sets the number of bytes that may be on the AX.25 receive queue before the host begins sending RNR frames.
  956.  
  957.  
  958. 3.4. Using connected mode AX.25 for moving IP datagrams
  959.  
  960. Since connected mode AX.25 is now supported these connections may be used for both host-to-TNC (chatting with your TNC-only equipped buddy or with the BBS) and for connected mode IP channels.  With IP you have your choice of "unconnected" or "connected" packets.  The command that controls this is the mode command.  The mode command allows you to select which style of connection will be used on a particular interface.  Here are two examples:
  961.  
  962. mode ax0 vc
  963. mode ax1 datagram
  964.  
  965. In the first example the interface named ax0 will use "connected" mode AX.25.  This can improve the link reliability and hence throughput when the link is somewhat marginal.  The second example causes your IP datagrams to be sent in UI frames (unproto or beacon packets).  This is the mode of choice on reliable links where very few packets are lost.  It reduces overhead so packets are transferred more rapidly.
  966.  
  967. 3.5. Tracing and Monitoring
  968.  
  969. NET.EXE has the most comprehensive and informative tracing features I have seen in any software package for packet radio.  The trace function understand AX.25, IP, TCP, and NET/ROM.
  970.  
  971. Tracing is enabled for each interface individually.  You have the choice of tracing incoming packets, outgoing packets, or both.  The format for the trace command is:
  972.  
  973. trace <interface> TIO
  974.  
  975. where <interface> is the name of the interface to be traced, T is the trace mode, I is for incoming packets, and O is for outgoing packets.  T, I, and O are digits.  The following table gives the values for T and their meanings:
  976.  
  977. 0    Trace headers only.  Do not display the data.
  978.  
  979. 1    Trace headers and data.  Display the data as ASCII, 64 characters to a line.
  980.  
  981. 2    Trace headers and data.  Display the entire packet as Hex and ASCII with 16 bytes displayed per line.
  982.  
  983. The values for I and O are either 1 or 0 depending on whether or not you want the respective incoming or outgoing packets traced or not.  Here are some examples:
  984.  
  985. trace ax0 010
  986. trace ax1 111
  987. trace ax0 201
  988.  
  989. In the first example incoming packets on interface ax0 will be traced.  Only the headers will be displayed.  The second example show both incoming and outgoing packets on ax1 being traced.  Data in the packets will be displayed as 64 ASCII characters on a line.  The last example will display a hex dump of all packets being transmitted on ax0.
  990.  
  991. I recommend using trace liberally.  You will learn a lot about packet radio when you can see what is being sent and to whom.  The trace display separates the different headers at the different layers.  Trace will display the link, network, and transport layer headers separately so you can see their relationship.
  992.  
  993. 3.6.  Running NET and BM Concurrently
  994.  
  995. In order to get the greatest use out of NET it is important to have it running all the time.  The problem with that is that DOS is not a multitasking operating system.  It is very frustrating to have to start and stop NET every time you want to do something else.  There are solutions: DoubleDos and DesqView.
  996.  
  997. The DoubleDos and DesqView packages from SoftLogic Solutions and Microsoft, respectively, solve this problem.  They permit you to split your memory into two partitions (or more, for DesqView) and allow each program to operate as if it had its own PC.  Phil Karn wrote NET with these "multitaskers" in mind and even included the necessary code in NET so that it can effectively reside with other programs without performance penalties to either NET or the other programs.  This will also allow you to send and receive mail with BM while NET is still running.  That way you will not have to exit from NET every time you want to prepare a mail message or read mail that has arrived.
  998.  
  999. The first step in using NET with DoubleDOS is to install DoubleDOS according to the instructions.  Part of installing DoubleDOS is to modify the file /DDCONFIG.SYS for your environment.  Many things can be changed in DDCONFIG.SYS but two are important to NET: size and program to load in the bottom partition.  When you edit DDCONFIG.SYS you will find a field named 'bottom size' and a field named 'bottom program.' If you want NET to be started automatically when you start DoubleDOS enter the following in DDCONFIG.SYS:
  1000.  
  1001. bottom program = /NET.EXE
  1002.  
  1003. DoubleDOS will normally split the available memory in half.  This is not the best solution because we know how much memory NET needs and we can then make sure that all of the rest of the available memory is available for the other partition.  NET itself needs about 150 Kb of memory.  In addition, NET needs COMMAND.COM also loaded in its partition.  For this reason you will probably want to allocate about 175 Kb to the bottom partition where NET will run.
  1004.  
  1005. Let us assume that you want to have both DoubleDOS and NET start when your system boots (just what you want after a power hit).  Add the following entry to your AUTOEXEC.BAT file:
  1006.  
  1007. /doubledos
  1008.  
  1009. That will cause DoubleDOS to start and DoubleDOS will automatically start NET.
  1010.  
  1011. 3.7. Installation on a Commodore Amiga
  1012.  
  1013. < not written yet >
  1014.  
  1015. 3.8. Installation on an Apple Macintosh
  1016.  
  1017. < not written yet >
  1018.  
  1019. 3.9. Installation under Unix
  1020.  
  1021. < not written yet >
  1022.  
  1023. 4. Operational Reference
  1024.  
  1025. 4.1. The NET.EXE Program
  1026.  
  1027. The executable file "net.exe" provides both client and server Internet facilities.  It implements the various ARPA protocols as both a host and gateway (i.e., it acts as an end-user node as well as an IP packet switch for transit traffic).  The keyboard and display is used by the local operator to control both host and gateway level functions, for which a number of commands are provided.
  1028.  
  1029. 4.1.1. Startup
  1030.  
  1031. When net.exe is executed without arguments, it attempts to open the file "autoexec.net" in the root directory of the current drive.  If it exists, it is read and executed as though its contents were typed on the console as commands.  This feature is useful for setting the local IP address and host name, initializing the IP routing table, and starting the various Internet services.  If net.exe is invoked with an argument, it is taken to be the name of an alternate startup file; it is read instead of autoexec.net.
  1032.  
  1033. 4.1.2. Console mode
  1034.  
  1035. The console may be in one of two modes: command mode and converse mode.  In command mode, the prompt "net>" is displayed and any of the commands described in the next section may be entered.  In converse mode, keyboard input is processed according to the "current session", which may be either a Telnet, FTP or AX.25 connection.  In a telnet or AX.25 session, keyboard input is sent to the remote system and any output from the remote system is displayed on the console.  In an FTP session, keyboard input is first examined to see if it is a known local command; if so it is executed locally.  If not, it is "passed through" to the remote FTP server.  (See the section titled "FTP Subcommands").
  1036.  
  1037. The keyboard also has "cooked" and "raw" states.  In cooked state, input is line-at-a-time; the user may use the line editing characters ^U, ^R and backspace to erase the line, redisplay the line and erase the last character, respectively.  Hitting either return or line feed passes the complete line up to the application.  In raw mode, each character is immediately passed to the application as it is typed.  The keyboard is always in cooked state in command mode.  It is also cooked in converse mode on an AX25 or FTP session.  In a Telnet session it depends on whether the remote end has issued (and the local end has accepted) the Telnet "WILL ECHO" option.  (See the "echo" command).
  1038.  
  1039. On the IBM-PC, the user may escape back to command mode by hitting the F10 key.  On other systems, the user must enter the "escape" character, which is by default control-] (hex 1d, ASCII GS).  (Note that this is distinct from the ASCII character of the same name).  The escape character can be changed (see the "escape" command).
  1040.  
  1041. 4.1.3. Commands
  1042.  
  1043. This section describes each of the commands recognized while in command mode.  Note that certain FTP subcommands, e.g., put, get, dir, etc, are recognized only in converse mode with the appropriate FTP session; they are not recognized while in command mode.  The notation "<hostid>" denotes a host or gateway, which may be specified in one of two ways: as a symbolic name listed in the file "/hosts.net", or as a numeric IP address in dotted decimal notation enclosed by brackets, e.g., [44.0.0.1].  When domain server support is added, ARPA-style domain names (e.g., ka9q.ampr) will also be accepted if a domain server is available on the network to resolve them into IP addresses.
  1044.  
  1045. 4.1.3.1. <cr>
  1046.  
  1047. Entering a carriage return (empty line) while in command mode puts you in converse mode with the current session.  If there is no current session, net remains in command mode.
  1048.  
  1049. 4.1.3.2. !
  1050.  
  1051. An alias for the "shell" command.
  1052.  
  1053. 4.1.3.3. #
  1054.  
  1055. Commands starting with the hash mark (#) are ignored.  This is mainly useful for comments in the autoexec.net file.
  1056.  
  1057. 4.1.3.4. arp
  1058.  
  1059. Displays the Address Resolution Protocol table that maps IP addresses to their subnet (link) addresses on subnetworks capable of broadcasting.  For each IP address entry the subnet type (e.g., Ethernet, AX.25), subnet address and time to expiration is shown.  If the link address is currently unknown, the number of IP datagrams awaiting resolution is also shown.
  1060.  
  1061. 4.1.3.5. attach <hw type> <I/O address> <vector> <mode> <label> <bufsize>
  1062. <mtu> [<speed>]
  1063.  
  1064. Configure and attach a hardware interface to the system.
  1065.  
  1066. a.    <hw type> represents the kind of I/O device that is being attached.  The following types are supported:
  1067.  
  1068. 3c500    3Com 3C500 or 3C501 Ethernet interface
  1069. asy    Standard PC asynchronous interface using the National 8250
  1070. hapn    Hamilton Amateur Packet Network adapter board (Intel 8273)
  1071. eagle    Eagle Computer card (Zilog 8530)
  1072. pc100    PACCOMM PC-100 (Zilog 8530)
  1073.  
  1074. These last two interfaces are still under development; driver code included in this package may or may not work.
  1075.  
  1076. B.    <I/O address> is the base address of the control registers for the device.
  1077.  
  1078. C.    <vector> is the interrupt vector number.  Both the address and the vector must be in hexadecimal.  (You may put "0x" in front of these two values if you wish, but note that they will be interpreted in hex even if you don't use it).
  1079.  
  1080. D.    <mode> controls how IP datagrams are to be encapsulated in the device's link level protocol; i.e., it selects among several link protocols that may be available.  The choices here depend on the interface; at present, the 3c500 interface only supports mode "arpa", which uses standard ARPA-style encapsulation.  (In the future, "802" may mean "use 802.3-style encapsulation").  Two modes for the "asy" device are currently supported:
  1081.  
  1082. slip    Encapsulates IP datagrams directly in SLIP frames without a link header.  This is for operation on point-to-point lines and is compatible with 4.2BSD UNIX SLIP).
  1083.  
  1084. ax25    Similar to slip, except that an AX.25 header and a KISS TNC control header are added to the front of the datagram before SLIP encoding.  Either UI (connectionless) or I (connection-oriented) AX.25 frames can be used; see the "mode" command for details.
  1085.  
  1086. The Address Resolution Protocol (ARP) maps IP to Ethernet addresses on Ethernet controllers and to AX.25 addresses on "asy" lines operating in "ax25" mode.
  1087.  
  1088. E.    <label> gives the name by which the interface will be known to the various commands, such as "connect", "route" and "trace".
  1089.  
  1090. F.    For asynchronous ports, <bufsize> specifies the size of the ring buffer in bytes to be statically allocated to the receiver; incoming bursts larger than this may (but not necessarily) cause data to be lost.  For Ethernet, <bufsize> specifies how many PACKETS may be queued on the receive queue at one time; if this limit is exceeded, further received packets will be discarded.  This is useful to prevent the system from running out of memory should another node suddenly develop a case of diarrhea.
  1091.  
  1092. G.    <mtu> is the Maximum Transmission Unit size, in bytes.  Datagrams larger than this limit will be fragmented at the IP layer into smaller pieces.  For AX.25 UI frames, this limits the size of the information field.  For AX.25 I frames, however, the ax25 paclen parameter is also relevant.  If the datagram or fragment is still larger than paclen, it is also fragmented at the AX.25 level (as opposed to the IP level) before transmission.  (See the "ax25 paclen" command for further information).
  1093.  
  1094. H.    <speed> is needed only for an "asy" line; the controller will be initialized to the given speed.
  1095.  
  1096. Examples:
  1097.  
  1098. # Attach a 3Com Ethernet controller using the standard 3Com address and
  1099. # vector (i.e., as it comes out of the box) to use ARPA-standard encapsulation.
  1100. # The receive queue is limited to 5 packets, and outgoing packets larger
  1101. # than 1500 bytes will be fragmented
  1102.  
  1103. attach 3c500 0x300 3 arpa ec0 5 1500
  1104.  
  1105. # Attach the PC asynch card normally known as "com1" (the first controller)
  1106. # to operate in point-to-point slip mode at 9600 baud, calling it "sl0".
  1107. # A 1024 byte receiver ring buffer is allocated.  Outgoing packets larger
  1108. # than 256 bytes are fragmented.
  1109.  
  1110. attach asy 0x3f8 4 slip sl0 1024 256 9600
  1111.  
  1112. # Attach the secondary PC asynch card ("com2") to operate in AX.25 mode
  1113. # with an MTU of 576 bytes at 9600 baud with a KISS TNC, calling it "ax0".
  1114. # By default, IP datagrams are sent in UI frames
  1115.  
  1116. attach asy 0x2f8 3 ax25 ax0 1024 576 9600
  1117.  
  1118. (Note that you cannot use the second asynch controller ("com2") and a 3Com Ethernet card with standard addressing at the same time because they both use interrupt vector 3).
  1119.  
  1120. ax25 digipeat [on|off]    Controls whether AX.25 packets addressed to this station as a digipeater will be repeated.
  1121.  
  1122. ax25 maxframe [<val]>]    Establishes the maximum number of frames that will be allowed to remain unacknowledged at one time on new AX.25 connections.  This number cannot be greater than 7.
  1123.  
  1124. ax25 mycall [<call>]    Display or set the local AX.25 address.  The standard format is used, e.g., KA9Q-0 or WB6RQN-5.  This command must be given before any attach command using AX.25 mode are given.
  1125.  
  1126. ax25 paclen [<val>]    Limits the size of I-fields on new AX.25 connections.  Note that if IP datagrams or fragments larger than this are transmitted, they will be transparently fragmented at the AX.25 level, sent as a series of I frames, and reassembled back into a complete IP datagram or fragment at the other end of the link.  This parameter should be less than the MTU of the associated interface.
  1127.  
  1128. ax25 reset <axcb>    Deletes the AX.25 connection control block at the specified address.
  1129.  
  1130. ax25 retry [<val>]    Limits the number of successive unsuccessful re-transmission attempts on new AX.25 connections.  If this limit is exceeded, link re-establishment is attempted.  If this fails "retry" times, then the connection is abandoned and all queued data is deleted.
  1131.  
  1132. ax25 status [<axcb>]    Without an argument, displays a one-line summary of each AX.25 control block.  If the address of a particular control block is specified, the contents of that control block are dumped in more detail.  Note that the send queue units are frames, while the receive queue units are bytes.
  1133.  
  1134. ax25 t1 [<val>] ax25 t2 [<val>] ax25 t3 [<val>]    Display or set the AX.25 timers to be used for new connections.  T1 is the retransmission timer, T2 is the acknowledgement delay timer and T3 is the idle "keep alive" timer.  Values are in seconds.
  1135.  
  1136. ax25 window [<val>]    Sets the number of bytes that can be pending on an AX.25 receive queue beyond which I frames will be answered with RNR (Receiver Not Ready) responses.  This presently applies only to suspended interactive AX.25 sessions, since incoming IP datagrams are always processed immediately and not allowed to remain on the receive queue.
  1137.  
  1138. cd [<dirname>]    Change the current working directory, and display the new setting.  Without an argument, cd simply displays the current directory without change.  The "pwd" command is an alias for "cd"
  1139.  
  1140. close [<session #>]    On an AX.25 session, this command initiates a disconnect.  On a FTP or Telnet session, this command sends a FIN (i.e., initiates a close) on the session's TCP connection.  This is an alternative to asking the remote server to initiate a close ("QUIT" to FTP, or the logout command appropriate for the remote system in the case of Telnet).  When either FTP or Telnet sees the incoming half of a TCP connection close, it automatically responds by closing the outgoing half of the connection.  Close is more graceful than the "reset" command, in that it is less likely to leave the remote TCP in a "half-open" state.
  1141.  
  1142. connect <interface> <callsign> [<digipeater> ...  ]    Initiates a "vanilla" AX.25 session to the specified call sign using the specified interface.  Up to 7 optional digipeaters may be given; note that the word "via" is NOT needed.  Data sent on this session goes out in conventional AX.25 packets with no upper layer protocol.  The de-facto presentation standard format is used, in that each packet holds one line of text, terminated by a carriage return.  A single AX.25 connection may be used for both terminal-to-terminal and IP traffic, with the two types of data being automatically separated by their AX.25 Level 3 Protocol IDs.
  1143.  
  1144. dir [<dirname>]    List the contents of the specified directory on the console.  If no argument is given, the current directory is listed.
  1145.  
  1146. disconnect [<session #>]    An alias for the "close" command (for the benefit of AX.25 users).
  1147.  
  1148. echo [accept|refuse]    Displays or changes the flag controlling client Telnet's response to a remote WILL ECHO offer.
  1149.  
  1150. The Telnet presentation protocol specifies that in the absence of a negotiated agreement to the contrary, neither end echoes data received from the other.  In this mode, a Telnet client session echoes keyboard input locally and nothing is actually sent until a carriage return is typed.  Local line editing is also performed: backspace deletes the last character typed, while control-U deletes the entire line.
  1151.  
  1152. When communicating from keyboard to keyboard the standard local echo mode is used, so the setting of this parameter has no effect.  However, many timesharing systems (e.g., UNIX) prefer to do their own echoing of typed input.  (This makes screen editors work right, among other things).  Such systems send a Telnet WILL ECHO offer immediately upon receiving an incoming Telnet connection request.  If "echo accept" is in effect, a client Telnet session will automatically return a DO ECHO response.  In this mode, local echoing and editing is turned off and each key stroke is sent immediately (subject to the Nagle tinygram algorithm in TCP).  While this mode is just fine across an Ethernet, it is clearly inefficient and painful across slow paths like packet radio channels.  Specifying "echo refuse" causes an incoming WILL ECHO offer to be answered with a DONT ECHO; the client Telnet session remains in the local echo mode.  Sessions already in the remote echo mode are unaffected.  (Note: Berkeley Unix has a bug in that it will still echo input even after the client has refused the WILL ECHO offer.  To get around this problem, enter the "stty -echo" command to the shell once you have logged in.)
  1153.  
  1154. 4.1.3.6. eol [unix|standard]
  1155.  
  1156. Displays or changes Telnet's end-of-line behavior when in remote echo mode.  In standard mode, each key is sent as-is.  In unix mode, carriage returns are translated to line feeds.  This command is not necessary with all UNIX systems; use it only when you find that a particular system responds to line feeds but not carriage returns.  Only Sun UNIX release 3.2 seems to exhibit this behavior; later releases are fixed.
  1157.  
  1158. 4.1.3.7. escape <char>
  1159.  
  1160. Without arguments, displays the current command-mode escape character in hex.  If given an argument, the first character becomes the new escape character.  (This command is not provided on the IBM-PC; on the PC, the escape char is always F10.)
  1161.  
  1162. .1.3.8. etherstat
  1163.  
  1164. Display 3-Com Ethernet controller statistics (if configured).
  1165.  
  1166. 4.1.3.9. exit
  1167.  
  1168. Exit the "net" program and return to MS-DOS (or CP/M).
  1169.  
  1170. 4.1.3.10. ftp <hostid>
  1171.  
  1172. Open an FTP control channel to the specified remote host and enter converse mode on the new session.  Responses from the remote server are displayed directly on the screen.
  1173.  
  1174. 4.1.3.11. help
  1175.  
  1176. Display a brief summary of top-level commands.
  1177.  
  1178. 4.1.3.12. hostname [<name>]
  1179.  
  1180. Displays or sets the local host's name (an ASCII string such as "ka9q-pc", NOT an IP address).  Currently this is used only in the greeting messages from the SMTP (mail) and FTP (file transfer) servers.
  1181.  
  1182. 4.1.3.13. log [stop | <file>]
  1183.  
  1184. Without arguments, indicates whether server sessions are being logged.  If "stop" is given as the argument, logging is terminated (the servers themselves are unaffected).  If a file name is given as an argument, server session log entries will be appended to it.
  1185.  
  1186. 4.1.3.14. ip address [<hostid>]
  1187.  
  1188. Displays or sets the local IP address.
  1189.  
  1190. 4.1.3.15. ip status
  1191.  
  1192. Displays Internet Protocol (IP) statistics, such as total packet counts and error counters of various types.  Also displays statistics about the Internet Control Message Protocol (ICMP), including the number of ICMP messages of each type sent or received.
  1193.  
  1194. 4.1.3.16. ip ttl [<val>]
  1195.  
  1196. Displays or sets the default time-to-live value placed in each outgoing IP datagram.  This limits the number of switch hops the datagram will be allowed to take.  The idea is to bound the lifetime of the packet should it become caught in a routing loop, so make the value somewhat larger than the diameter of the network.
  1197.  
  1198. 4.1.3.17. memstat
  1199.  
  1200. Displays the internal free memory list in the storage allocator.
  1201.  
  1202. 4.1.3.18. mode <interface> [vc|datagram]
  1203.  
  1204. Controls the default transmission mode on the specified AX.25 interface.  In "datagram" mode, IP packets are encapsulated in AX.25 UI frames and transmitted without any other link level mechanisms, such as connections or acknowledgements.
  1205.  
  1206. In "vc" (virtual circuit) mode, IP packets are encapsulated in AX.25 I frames and are acknowledged at the link level according to the AX.25 protocol.  Link level connections are opened if necessary.  With the proper setting of the AX.25 T2 (acknowledgement delay) timer, AX.25 acknowledgements can be piggybacked on I frames carrying other IP datagrams (e.g., TCP level acknowledgements), thereby eliminating the extra overhead ordinarily incurred by link level acknowledgments.
  1207.  
  1208. In both modes, ARP is used to map IP to AX.25 addresses.  The defaults can be overridden with the type-of-service (TOS) bits in the IP header.  Turning on the "reliability" bit causes I frames to be used, while turning on the "low delay" bit uses UI frames.  (The effect of turning on both bits is undefined and subject to change).
  1209.  
  1210. In both modes, IP-level fragmentation is done if the datagram is larger than the interface MTU.  In virtual circuit mode, however, the resulting datagram (or fragments) is further fragmented at the AX.25 layer if it (or they) are still larger than the AX.25 "paclen" parameter.  In AX.25 fragmentation, datagrams are broken into several I frames and reassembled at the receiving end before being passed to IP.  This is preferable to IP fragmentation whenever possible because of decreased overhead (the IP header isn't repeated in each fragment) and increased robustness (a lost fragment is immediately retransmitted by the link layer).
  1211.  
  1212. 4.1.3.19. param <interface> [param ...]
  1213.  
  1214. Param invokes a device-specific control routine.  On a KISS TNC interface, this sends control packets to the TNC.  Data bytes are treated as decimal.  For example, "param ax0 1 255" will set the keyup timer (type field = 1) on the KISS TNC configured as ax0 to 2.55 seconds (255 x .01 sec).  On a SLIP interface, the param command allows the baud rate to be read (without arguments) or set.  The implementation of this command for the various interface drivers is incomplete and subject to change.
  1215.  
  1216. 4.1.3.20. pwd [<dirname>]
  1217.  
  1218. An alias for the cd command.
  1219.  
  1220. 4.1.3.21. record [<filename>|off]
  1221.  
  1222. Opens <filename> and appends to it all data received on the current session.  Data sent on the current session is also written into the file except for Telnet sessions in remote echo mode.  The command "record off" stops recording and closes the file.  This command is not supported for FTP sessions.
  1223.  
  1224. 4.1.3.22. reset [<session>]
  1225.  
  1226. If an argument is given, force a local reset (deletion) of the AX.25 (AXCB) or TCP Control Block (TCB) belonging to the specified session.  The argument is first checked for validity.  If no argument is given, the current session, if any, is used.  This command should be used with caution since it does not inform the remote end that the connection no longer exists.  (In TCP a reset (RST) message will be automatically generated should the remote TCP send anything after a local reset has been done.  In AX.25 the DM message performs a similar role.  Both are used to get rid of a lingering half-open connection after a remote system has crashed.)
  1227.  
  1228. 4.1.3.23. route
  1229.  
  1230. route add <dest hostid>[/bits]|default <interface> [<gateway hostid> [<metric>]]
  1231. route drop <dest hostid>
  1232.  
  1233. With no arguments, "route" displays the IP routing table.  "route add" adds an entry to the routing table, while "route drop" deletes an existing entry.  "route add" requires at least two more arguments, the host id of the target destination and the local name of the interface to which its packets should be sent.  If the destination is not local, the gateway's host id should also be specified.  (If the interface is a point-to-point link, then <gateway hostid> may be omitted even if the target is non-local because this field is only used to determine the gateway's link level address, if any.  If the destination is directly reachable, <gateway hostid> is also unnecessary since the destination address is used to determine the interface link address).
  1234.  
  1235. The optional "/bits" suffix to the destination host id specifies how many leading bits in the host id are to be considered significant in the routing comparisons.  If not specified, 32 bits (i.e., full significance) is assumed.  With this option, a single routing table entry may refer to many hosts all sharing a common bit string prefix in their IP addresses.  For example, ARPA Class A, B and C networks would use suffixes of /8, /16 and /24 respectively; the command
  1236.  
  1237. route add [44]/8 sl0 [44.64.0.2]
  1238.  
  1239. causes any IP addresses beginning with "44" in the first 8 bits to be routed to [44.64.0.2]; the remaining 24 bits are "don't-cares".
  1240.  
  1241. When an IP address to be routed matches more than one entry in the routing table, the entry with largest "bits" parameter (i.e., the "best" match) is used.  This allows individual hosts or blocks of hosts to be exceptions to a more general rule for a larger block of hosts.
  1242.  
  1243. The special destination "default" is used to route datagrams to addresses not in the routing table; it is equivalent to specifying a /bits suffix of /0 to any destination hostid.  Care must be taken with default entries since two nodes with default entries pointing at each other will route packets to unknown addresses back and forth in a loop until their time-to-live (TTL) fields expire.  (Routing loops for specific addresses can also be created, but this is less likely to occur accidentally).
  1244.  
  1245. "route drop" deletes an entry from the table.  If a packet arrives for the deleted address and a default route is in effect, it will be used.
  1246.  
  1247. Here are some examples of using the route command:
  1248.  
  1249. # Route datagrams to IP address 44.0.0.3 to SLIP line #0.
  1250. # No gateway is needed because SLIP is point-to point.
  1251. route add [44.0.0.3] sl0
  1252.  
  1253. # Route all default traffic to the gateway on the local Ethernet
  1254. # with IP address [44.0.0.1]
  1255. route add default ec0 [44.0.0.1]
  1256.  
  1257. # The local Ethernet has an ARPA Class-C address assignment;
  1258. # route all IP addresses beginning with 192.4.8 to it
  1259. route add [192.4.8]/24 ec0
  1260.  
  1261. # The station with IP address [44.0.0.10] is on the local AX.25 channel
  1262. route add [44.0.0.10] ax0
  1263.  
  1264.  
  1265. 4.1.3.24. session [<session #>]
  1266.  
  1267. Without arguments, displays the list of current sessions, including session number, remote TCP or AX.25 address and the address of the TCP or AX.25 control block.  An asterisk (*) is shown next to the "current" session; entering <cr> at this point will put you in converse mode with that session.  Entering a session number as an argument to the session command will put you in converse mode with that session.  If the telnet server is enabled, the user is notified of an incoming request and a session number is automatically assigned.  The user may then select the session normally to converse with the remote user as though the session had been locally initiated.
  1268.  
  1269. 4.1.3.25. shell
  1270.  
  1271. Suspends "net" and executes a sub shell ("command processor" under MS-DOS).  When the sub shell exits, net resumes (under MS-DOS, enter the "exit" command).  Note that background activity (FTP servers, etc) is also suspended while the subshell executes.
  1272.  
  1273. 4.1.3.26. smtp gateway [<hostid>]
  1274.  
  1275. Displays or sets the host to be used as a "smart" mail relay.  Any mail sent to a hostid not in the host table will instead be sent to the gateway for forwarding.
  1276.  
  1277. 4.1.3.27. smtp kick
  1278.  
  1279. Run through the outgoing mail queue and attempt to deliver any pending mail.  This command is periodically invoked by a timer whenever net is running; this command allows the user to "kick" the mail system manually.
  1280.  
  1281. 4.1.3.28. smtp maxclients [<val>]
  1282.  
  1283. Displays or sets the maximum number of simultaneous outgoing SMTP sessions that will be allowed.  The default is 10; reduce it if network congestion is a problem.
  1284.  
  1285. 4.1.3.29. smtp timer [<val>]
  1286.  
  1287. Displays or sets the interval, in seconds, between scans of the outbound mail queue.  For example, "smtp timer 600" will cause the system to check for outgoing mail every 10 minutes and attempt to deliver anything it finds, subject of course to the "maxclients" limit.  Setting a value of zero disables queue scanning altogether, note that this is the default! This value is recommended for stand alone IP gateways that never handle mail, since it saves wear and tear on the floppy disk drive.
  1288.  
  1289. 4.1.3.30. smtp trace [<val>]
  1290.  
  1291. Displays or sets the trace flag in the SMTP client, allowing you to watch SMTP's conversations as it delivers mail.  Zero (the default) disables tracing.
  1292.  
  1293. 4.1.3.31. start ftp|smtp|telnet|discard|echo
  1294.  
  1295. Starts the specified Internet server, allowing remote connection requests.
  1296.  
  1297. 4.1.3.32. stop ftp|smtp|telnet|discard|echo
  1298.  
  1299. Stops the specified Internet server, rejecting any further remote connect requests.  Existing connections are allow to complete normally.
  1300.  
  1301. 4.1.3.33. tcp irtt [<val>]
  1302.  
  1303. Display or set the intial round trip time estimate, in seconds, to be used for new TCP connections until they can measure and adapt to the actual value.  The default is 5 seconds.  Increasing this when operating over slow channels will avoid the flurry of retransmissions that would otherwise occur as the smoothed estimate settles down at the correct value.  Note that this command should be given before servers are started in order for it to have effect on incoming connections.
  1304.  
  1305. 4.1.3.34. tcp kick <tcb.addr>
  1306.  
  1307. If there is data on the send queue of the specified tcb, this command forces an immediate retransmission.
  1308.  
  1309. 4.1.3.35. tcp mss [<size>]
  1310.  
  1311. Display or set the TCP Maximum Segment Size in bytes that will be sent on all outgoing TCP connect request (SYN segments).  This tells the remote end the size of the largest segment (packet) it may send.  Changing MSS affects only future connections; existing connections are unaffected.
  1312.  
  1313. 4.1.3.36. tcp reset <tcbaddr>
  1314.  
  1315. Deletes the TCP control block at the specified address.
  1316.  
  1317. 4.1.3.37. tcp rtt <tcbaddr> <rttval>
  1318.  
  1319. Replaces the automatically computed round trip time in the specified tcb with the rttval in milliseconds.  This command is useful to speed up recovery from a series of lost packets since it provides a manual bypass around the normal backoff retransmission timing mechanisms.
  1320.  
  1321. 4.1.3.38. tcp status [<tcb.addr>]
  1322.  
  1323. Without arguments, displays several TCP-level statistics, plus a summary of all existing TCP connections, including TCB address, send and receive queue sizes, local and remote sockets, and connection state.  If <tcbddr> is specified, a more detailed dump of the specified TCB is generated, including send and receive sequence numbers and timer information.
  1324.  
  1325. 4.1.3.39. tcp window [<val>]
  1326.  
  1327. Displays or sets the default receive window size in bytes to be used by TCP when creating new connections.  Existing connections are unaffected.
  1328.  
  1329. 4.1.3.40. telnet <hostid>
  1330.  
  1331. Creates a Telnet session to the specified host and enters converse mode.
  1332.  
  1333. 4.1.3.41. trace [<interface> [<flags>]]
  1334.  
  1335. Controls packet tracing by the interface drivers.  Specific bits enable tracing of the various interfaces and the amount of information produced.  Tracing is controlled on a per-interface basis; without arguments, trace gives a list of all defined interfaces and their tracing status.  Output can be limited to a single interface by specifying it, and the control flags can be changed by specifying them as well.  The flags are given as a hexadecimal number which is interpreted as follows:
  1336.  
  1337. TIO
  1338. |||    Enable tracing of output packets if 1, disable if 0
  1339. ||    Enable tracing of input packets if 1, disable if 0
  1340. |    Controls type of tracing:
  1341. 0 -    Protocol headers are decoded, but data is not displayed
  1342. 1 -    Protocol headers are decoded, and data (but not the headers themselves) are displayed as ASCII characters, 64 characters/line.  Unprintable characters are displayed as periods.
  1343. 2 -    Protocol headers are decoded, and the entire packet (headers AND data) is also displayed in hexadecimal and ASCII, 16 characters per line.
  1344.  
  1345.  
  1346. 4.1.3.42. udp status
  1347.  
  1348. Displays the status of all UDP receive queues.
  1349.  
  1350. 4.1.3.43. upload [<filename>]
  1351.  
  1352. Opens <filename> and sends it on the current session as though it were typed on the terminal.  Valid only on AX.25 and Telnet sessions.
  1353.  
  1354. 4.1.3.44. ?
  1355.  
  1356. Same as the "help" command.
  1357.  
  1358. 4.1.4. FTP Subcommands
  1359.  
  1360. When in converse mode with an FTP server, everything typed on the console is first examined to see if it is a locally-known command.  If not, the line is passed intact to the remote server on the control channel.  If it is one of the following commands, however, it is executed locally.  (Note that this generally involves other commands being sent to the remote server on the control channel.) When actively transferring a file, the only acceptable command is "abort"; all other commands will result in an error message.
  1361.  
  1362. 4.1.4.1. abort
  1363.  
  1364. Aborts a get, put or dir operation in progress.  When receiving a file, abort simply resets the data connection; the next incoming data packet will generate a TCP RST (reset) in response which will clear the remote server.  When sending a file, abort sends a premature end-of-file.  Note that in both cases abort will leave a partial copy of the file on the destination machine, which must be removed manually if it is unwanted.  Abort is valid only when a transfer is in progress.
  1365.  
  1366. 4.1.4.2. dir [<file>|<directory> [<local file>]]
  1367.  
  1368. Without arguments, "dir" requests that a full directory listing of the remote server's current directory be sent to the terminal.  If one argument is given, this is passed along in the LIST command; this can be a specific file or subdirectory that is meaningful to the remote file system.  If two arguments are given, the second is taken as the local file into which the directory listing should be put (instead of being sent to the console).  The PORT command is used before the LIST command is sent.
  1369.  
  1370. 4.1.4.3. get <remote file> [<local file>]
  1371.  
  1372. Asks the remote server to send the file specified in the first argument.  The second argument, if given, will be the name of the file on the local machine; otherwise it will have the same name as on the remote machine.  The PORT and RETR commands are sent on the control channel.
  1373.  
  1374. 4.1.4.4. ls [<file>|<directory> [<local file>]]
  1375.  
  1376. ls is identical to the "dir" command except that the "NLST" command is sent to the server instead of the "LIST" command.  This results in an abbreviated directory listing, i.e., one showing only the file names themselves without any other information.
  1377.  
  1378. 4.1.4.5. mkdir <remote directory>
  1379.  
  1380. Creates a directory on the remote machine.
  1381.  
  1382. 4.1.4.6. put <local file> [<remote file>]
  1383.  
  1384. Asks the remote server to accept data, creating the file named in the first argument.  The second argument, if given, will be the name of the file on the remote machine; otherwise it will have the same name as on the local machine.  The PORT and STOR commands are sent on the control channel.
  1385.  
  1386. 4.1.4.7. rmdir <remote directory>
  1387.  
  1388. Deletes a directory on the remote machine.
  1389.  
  1390. 4.1.4.8. type [a | i | l <bytesize>]
  1391.  
  1392. Tells both the local client and remote server the type of file that is to be transferred.  The default is 'a', which means ASCII (i.e., a text file).  Type 'i' means "image", i.e., binary.  In ASCII mode, files are sent as varying length lines of text in ASCII separated by cr/lf sequences; in IMAGE mode, files are sent exactly as they appear in the file system.  ASCII mode should be used whenever transferring text between dissimilar systems (e.g., UNIX and MS-DOS) because of their different end-of-line and/or end-of-file conventions.  When exchanging text files between machines of the same type, either mode will work but IMAGE mode may be somewhat faster.  Naturally, when exchanging raw binary files (executables, compressed archives, etc) IMAGE mode must be used.  Type 'l' (logical byte size) is used when exchanging binary files with remote servers having oddball word sizes (e.g., DECSYSTEM-10s and 20s).  Locally it works exactly like IMAGE, except that it notifies the remote system how large the byte size is.  <bytesize> is typically 8.  The type command sets the local transfer mode and generates the TYPE command on the control channel.
  1393.  
  1394. 4.1.5. FTP server configuration
  1395.  
  1396. Since MS-DOS was designed as a single-user operating system, it provides no access control; all files can be read, written or deleted by the local user.  It is usually undesirable to give such open access to a system to remote network users.  The FTP server therefore provides its own access control mechanism.
  1397.  
  1398. The file "/ftpusers" is used to control remote FTP access.  The default is NO access; if this file does not exist, the FTP server will be unusable.  A remote user must first "log in" to the system with the USER and PASS commands, giving a valid name and password listed in /ftpusers, before he or she can transfer files.
  1399.  
  1400. Each entry in /ftpusers consists of a single line of the form
  1401.  
  1402. username password /path permissions
  1403.  
  1404. There must be exactly four fields, and there must be exactly one space between each field.  Comments may be added after the last field.  Comment lines are begun with "#" in column one.
  1405.  
  1406. a.    "username" is the user's login name.
  1407.  
  1408. b.    "password" is the required password.  Note that this is in plaintext; therefore it is not a good idea to give general read permission to the root directory.  A password of "*" (a single asterisk) means that any password is acceptable.
  1409.  
  1410. c.    "/path" is the allowable prefix on accessible files.  Before any file or directory operation, the current directory and the userspecified file name are joined to form an absolute path name in "canonical" form (i.e., a full path name starting at the root, with "./" and "../" references, as well as redundant /'s, recognized and removed).  The result MUST begin with the allowable path prefix; if not, the operation is denied.  NB! Under MS-DOS, this field must use backslashes ("\"), NOT forward slashes ("/").  This field must always begin with a "/", i.e., at the root directory.
  1411.  
  1412. d.    "permissions" is a decimal number granting permission for read, create and write operations.  If the low order bit (0x1) is set, the user is allowed to read a file subject to the path name prefix restriction.  If the next bit (0x2) is set, the user is allowed to create a new file if it does not overwrite an existing file.  If the third bit (0x4) is set, the user is allowed to write a file even if it overwrites an existing file, and in addition he may delete files.  Again, all operations are allowed subject to the path name prefix restrictions.  Permissions may be combined by adding bits, for example, 0x3 (= 0x2 + 0x1) means that the user is given read and create permission, but not overwrite/delete permission.
  1413.  
  1414. For example, suppose /ftpusers on machine "pc.ka9q.ampr" contains the line
  1415.  
  1416. friendly test /testdir 7
  1417.  
  1418. A session using this account would look like this:
  1419.  
  1420. net> ftp pc.ka9q.ampr
  1421. SYN Sent
  1422. Established
  1423. 250 pc.ka9q.ampr FTP version 871225.5 ready at Wed Jan 20 16:27:18 1988
  1424. user friendly
  1425. 331 Enter PASS command
  1426. pass test
  1427. 230 Logged in
  1428.  
  1429. The user now has read, write, overwrite and delete privileges for any file under /testdir; he may not access any other files.
  1430.  
  1431. Here are some more sample entries in /ftpusers:
  1432.  
  1433. karn foobar / 7    #    User "karn" with password "foobar" may read, write, overwrite and delete any file on the system.
  1434.  
  1435. guest bletch /g/bogus 3    #    User "guest" with password "bletch" may read any file under /g/bogus and its subdirectories, and may create a new file as long as it does not overwrite an existing file.  He may NOT delete any files.
  1436.  
  1437. anonymous * /public 1    #    User "anonymous" (any password) may read files under /public and its subdirectories; he may not create, overwrite or delete any files.
  1438.  
  1439.  
  1440. I recommend this last entry as a standard convention for keeping a repository of downloadable files; in particular, the username "anonymous" is an established ARPA convention.
  1441.  
  1442. 4.2. The BM.EXE Mail User Interface Program
  1443.  
  1444. Many thanks to Gerard PA0GRI who is primarily responsible for the addition of features to version 2, and to Dave Trulli NN2Z who is responsible for the changes and additions making up version 3.
  1445.  
  1446. 4.2.1. Configuring the SMTP Environment
  1447.  
  1448. As supplied, the SMTP server and client make assumptions about the disk space available to them.  In particular, the file handling portion of the client and server will need to be modified heavily if used on any operating system other than PC-Dos or MS-Dos.  Sorry.
  1449.  
  1450. To achieve minimum functionality, you should create directories /spool/mail and /spool/mqueue on the default disk used when running net.exe...  the mail directory is used by the server for storing incoming mail, the mqueue directory is where the client looks to find outbound messages that need to be delivered.
  1451.  
  1452. There is one command in net.exe that relates to the SMTP client operation.  It is 'smtp'.  Issuing this command will cause the client to attempt to deliver mail immediately.  Normally, the client will fire up 15 mins after the end of the previous invocation to try and process outbound mail.  The smtp command is primarily a debugging tool, and should be used as such.
  1453.  
  1454. 4.2.1.1. File Formats
  1455.  
  1456. Incoming mail for users on the current host gets placed in 'mailbox' files in the /spool/mail directory.  The name of the file is based on the user name given by the sending SMTP agent.  These are simple text files, with new messages appended to the end.  If a mailbox file does not exist, the server will create it automagically.  Messages in the files are in RFC822 format, with new messages appended to the end.  The first line of each message will always start with the token 'Received:', quotes not included.  This line is added by the server to indicate the date and time the message was received, and the host it was received from.
  1457.  
  1458. Outgoing mail messages consist of two files each in the /spool/mqueue directory.  The names of the two files will be of the form <integer>.WRK and <integer>.TXT, where integer is the sequence number of the message relative to this machine.  The file sequence.seq in the mqueue directory contains the current sequence number for reference by the mail user interface.  The .TXT file contains the data portion of the SMTP transaction, in full RFC822 format.  The .WRK file consists of 3 lines, as follows:
  1459.  
  1460. o+    the hostname of the destination system
  1461.  
  1462. o+    the full sender address, in user@host format.
  1463.  
  1464. o+    the full destination address, in user@host format.
  1465.  
  1466. The mailer does not yet support multiple recipients; when it does, the .wrk file format will contain extra destination address lines, one for each additional recipient.
  1467.  
  1468. 4.2.1.2. Bugs and Limitations
  1469.  
  1470. The SMTP server does not allow forwarding.  In a perfect world, forwarding is a crock.  Since we do not live in a perfect world, some specialized forward capability will probably be added eventually...  though we'd like to avoid it! Better to just put a bsd4.X system on the air and let Sendmail handle the grody work! :-)
  1471.  
  1472. The SMTP client only understands a single destination address in the TO line.  This is a legal minimal implementation of the standard, but will eventually change.  Note that the format of the .WRK file will change when this does, of necessity.
  1473.  
  1474. Error returns from the remote server are not properly handled.  The mailer will keep trying to deliver the mail each time the smtp command is issued (or invoked automatically by the timer).  There is as yet no mechanism for "bouncing" mail back to the sender when it cannot be sent.
  1475.  
  1476. The smtp client (mail sender) code in net.exe now tries to connect to all destination hosts simultaneously.  If there is a lot of mail in the outbound queue, this may cause problems.  In particular, try using the FILES= parameter in the MS-DOS config.sys file to allow net.exe to have more than the default 8 files open at once.
  1477.  
  1478. 4.2.1.3. For More Information
  1479.  
  1480. The SMTP specification is RFC821.  The Format for text messages (including the headers) is in RFC822.  RFC819 discusses hostname naming conventions, particularly domain naming.
  1481.  
  1482. 4.2.2. BM Setup
  1483.  
  1484. In order to make use of BM, you must first follow the installation instructions in the file SMTP.DOC to provide minimal SMTP support.  Then, you should:
  1485.  
  1486. o+    copy the files BM.RC and HOSTS.NET to the root directory of the default drive used when NET.EXE is running.
  1487.  
  1488. o+    edit HOSTS.NET to reflect the hosts you will exchange mail with.  the format of each line of this file is:
  1489.  
  1490. IPddress <tab> hostname <newline>
  1491.  
  1492. The IP address should be of the form 0.0.0.0, and the hostname can be any token you wish to use to represent that host.  In particular, it does NOT need to be the full legal name of the host.
  1493.  
  1494. o+    edit the file /BM.RC to correctly identify your hostname, username, and the IP address of the system you wish to punt mail to when you don't know the correct IP address.  The format lines in this file is:
  1495.  
  1496. token <space> value <newline>
  1497.  
  1498. where the currently defined tokens are 'host' for this system's hostname, 'user' for your username, and 'gate' for the ip address of the nearest 'smart mailer'.  More on this below.  Additional tokens exist for setting your local timezone, and mailbox directory, and editor to be used in message creation.
  1499.  
  1500. 4.2.3. Operation
  1501.  
  1502. BM is designed to serve as the mail user-interface for users of the KA9Q internetworking software package.  The purpose of BM is to provide a full set of electronic mail services to the user.  These include sending messages, listing and reading received messages, and so forth.
  1503.  
  1504. BM reads mailbox files created by the SMTP server in NET.EXE, which are stored in a directory (usually /spool/mail) that is specified in the config file /bm.rc.  Incoming mail is stored by the server in mailbox files, one per username.  These mailbox files may also be referred to as "notefiles".  The default mailbox to read is specified with the 'user' option in the /bm.rc file.  This username is also used on all outgoing messages.
  1505.  
  1506. The /bm.rc file also defines a timezone stamp, which in conjunction with the DOS date and time is used to provide the required RFC822 Date: header.
  1507.  
  1508. Commands are generally one character long and followed by a space, and parameter if needed:
  1509.  
  1510. s    Send a message.  The user is prompted for a destination address and subject.  BM then creates appropriate RFC822 headers in a temporary file, and either invokes the user's favorite editor (specified with the 'edit' parameter in /bm.rc) to enter the message text, or uses a simple/stupid text entry routine if no editor is defined.  Note that if you are using an editor, you should start by jumping to the end of the file.  RFC822 requires that the headers be first and be separated from the text of a message by at least one blank line.
  1511.  
  1512. In this release, Phil KA9Q has modified BM slightly to be more like the Berkeley Unix mail program.  When the message entry routine first starts, you will be in the silly text editor.  If you want to use your editor on the message, type '~e<ret>'...  not obvious to most folks, but very obvious to 4bsd fans...  [sigh].
  1513.  
  1514. t    Transmits an already created file as a message.  RFC822 headers are prepended.  This is useful if you don't have an editor that will work with the 's' command.
  1515.  
  1516. *** NOTE ***    RFC822 only allows 7bit data.  If you want to send a binary file, use BSQ, or UUENCODE, or something similar to convert it to a text file first! Better yet, use FTP...
  1517.  
  1518. r    Read all messages in the current notefile.
  1519.  
  1520. u    Updates you with new messages in the notefile, shows them to you and updates the read marker to the last one read.  If no new messages came in, you will be notified.
  1521.  
  1522. f    Forward a message to someone else.  A temporary copy is made of the message specified and that is handed over to the send message routine, which treats it as a file ala the 't' command.
  1523.  
  1524. d    Delete a message.  Parameter is the message number.  If the number of the to be deleted message is higher than the last read message an "are you sure" message is printed.  'Y' or 'y' will delete it...
  1525.  
  1526. h    Displays message headers, a message number, received date, from whom and the subject fields on an single line.  An star is put in front of the last read message.
  1527.  
  1528. p    Sets the printer on or off so messages to the screen also go to the printer.  ** This will be implemented in a future release.  **
  1529.  
  1530. l    Lists the file names of messages waiting to be sent that are in the queue directory, usually /spool/mqueue.  Primarily useful for debugging.
  1531.  
  1532. n    Shows the notefiles in the mail directory, the location of which is specified by the 'smtp' parameter in the /bm.rc file.  If this command is followed with a parameter, the current notefile will be changed to the specified notefile.  If it does not exist you will be notified if you try something with it.
  1533.  
  1534. #    Substitute # with a number (1..whatever) and it will show you the message in the current active notefile with that number.  If the message is the one next to the last read one the * will be moved.
  1535.  
  1536. ?    Prints a short command summary to the screen.
  1537.  
  1538. q    Quit.
  1539.  
  1540. The program's prompt will always show the current notefile name.
  1541.  
  1542. 4.2.4. Additional Information
  1543.  
  1544. BM will prompt you for a To: address.  This should be in the form user@host, where user will be the name of the mailbox file on the destination KA9Q system, or the username of the intended recipient on other SMTP-equipped systems.  The host field should exactly match a host token in the HOSTS.NET file.  If it does not, the SMTP client in NET.EXE will insert the IP address of the nearest "smart mail agent" in the work file instead of the destination IP address (since it is unknown).  The rationale behind this is that many SMTP equipped systems include the ability to forward mail that is not addressed to them.  If you have a system of this type nearby, you may be able to "punt" mail to them for handling.
  1545.  
  1546. Note that if there is such a smart mailer on a system near you, you can replace the simple 'user' field with a full address that the smart mailer can understand, since BM will scan from the right taking everything after the rightmost '@' to be the host token, and will not mangle the address.  For example, from my PC clone I can easily mail to:
  1547.  
  1548. bellcore!karn@winfree    (to get to Phil, KA9Q)
  1549.  
  1550. where winfree is my Unix system, which talks to system bellcore via UUCP.  BM really doesn't care what you put for an address as long as there is a system within range that it can punt to when it doesn't understand what you mean.  Note that this implies you should be extra careful when typing addresses!
  1551.  
  1552. Read the SMTP.DOC file for specification of the queue and mailbox files, and limitations of the SMTP client that affect BM's capabilities.
  1553.  
  1554. 5. Appendices
  1555.  
  1556. 5.1. Technical Information for Client/Server Developers
  1557.  
  1558. This section describes the "guts" of the Internet package for the benefit of programmers who wish to write their own applications, or adapt the code to different hardware environments.
  1559.  
  1560. The code as distributed includes both the functions of an IP packet switch and an end-host system, including several servers.  The implementation is highly modular, however.  For example, if one wants to build a dedicated packet switch without any local applications, the various applications and the TCP and UDP modules may easily be omitted to save space.
  1561.  
  1562. The package allows multiple simultaneous applications, each supporting multiple simultaneous users, each using TCP and/or UDP.  The only limit is memory space, which is getting quite tight on the 820; the C compiler for the IBM PC seems to generate much more compact code (typically 1/2 as large as for the Z-80) so the PC seems more promising as a large-scale server.
  1563.  
  1564. 5.1.1. Data Structures
  1565.  
  1566. To increase portability, the pseudo-types "int16" and "int32" are used to mean an unsigned 16-bit integer and a signed 32-bit integer, respectively.  Ordinarily these types are defined in machdep.h to be "unsigned int" and "long".
  1567.  
  1568. The various modules pass data in chained structures called mbufs, with the following format:
  1569.  
  1570. struct mbuf {
  1571. struct mbuf *next;    /* Links mbufs belonging to single packets */
  1572. struct mbuf *anext;    /* Links packets on queues */
  1573. char *data;    /* Pointer to start of actual data in buffer */
  1574. int16 cnt;    /* Length of data in buffer */
  1575. };
  1576.  
  1577. Although somewhat cumbersome to work with, mbufs make it possible to avoid memory-to-memory copies that limit performance.  For example, when user data is transmitted it must first traverse several protocol layers before reaching the transmitter hardware.  With mbufs, each layer adds its protocol header by allocating an mbuf and linking it to the head of the mbuf "chain" given it by the higher layer, thus avoiding several copy operations.
  1578.  
  1579. A number of primitives operating on mbufs are available in mbuf.c.  The user may create, fill, empty and free mbufs himself with the allocbuf and freebuf primitives, or at the cost of a single memory-to-memory copy he he may use the more convenient qdata() and dqdata() primitives.
  1580.  
  1581. 5.1.2. Timer Services
  1582.  
  1583. TCP and IP require timers.  A timer package is included, so the user must arrange to call the single entry point "tick" on a regular basis.  The constant MSPTICK in timer.h should be defined as the interval between ticks in milliseconds.  One second resolution is adequate.  Since it can trigger a considerable amount of activity, including upcalls to user level, "tick" should not be called from an interrupt handler.  A clock interrupt should set a flag which will then cause "tick" to be called at user level.
  1584.  
  1585. 5.1.3. Internet Type-of-Service
  1586.  
  1587. One of the features of the Internet is the ability to specify precedence (i.e., priority) on a per-datagram basis.  There are 8 levels of precedence, with the bottom 6 defined by the DoD as Routine, Priority, Immediate, Flash, Flash Override and CRITICAL.  (Two more are available for internal network functions).  For amateur use we can use the lower four as Routine, Welfare, Priority and Emergency.  Three more bits specify class of service, indicating that especially high reliability, high throughput or low delay is needed for this connection.  Constants for this field are defined in internet.h.
  1588.  
  1589. 5.1.4. The Internet Protocol Implementation
  1590.  
  1591. While the user does not ordinarily see this level directly, it is described here for sake of completeness.  Readers interested only in the interfaces seen by the applications programmer should skip to the TCP and UDP sections.
  1592.  
  1593. The IP implementation consists of three major functions: ipoute, ipend and ipecv.
  1594. 5.1.5. IP Gateway (Packet Router) Support
  1595.  
  1596. The first, ipoute, is the IP packet switch.  It takes a single argument, a pointer to the mbuf containing the IP datagram:
  1597.  
  1598. void
  1599. ipoute(bp,rxbroadcast)
  1600. struct mbuf *bp;    /* Datagram pointer */
  1601. int rxbroadcast;    /* Don't forward */
  1602.  
  1603. All IP datagrams, coming or going, pass through this function.  After option processing, if any, the datagram's destination address is extracted.  If it corresponds to the local host, it is "kicked upstairs" to the upper half of IP and thence to the appropriate protocol module.  Otherwise, an internal routing table consulted to determine where the datagram should be forwarded.  The routing table uses hashing keyed on IP destination addresses, called "targets".  If the target address is not found, a special "default" entry, if available, is used.  If a default entry is not available either, an ICMP "Destination Unreachable" message containing the offending IP header is returned to the sender.
  1604.  
  1605. The "rxbroadcast" flag is used to prevent forwarding of broadcast packets, a practice which might otherwise result in spectacular routing loops.  Any subnet interface driver receiving a packet addressed to the broadcast address within that subnet MUST set this flag.  All other packets (including locally originated packets) should have "rxbroadcast" set to zero.
  1606.  
  1607. ipoute ignores the IP destination address in broadcast packets, passing them up to the appropriate higher level protocol which is also made aware of their broadcast nature.  (TCP and ICMP ignore them; only UDP can accept them).
  1608.  
  1609. Entries are added to the IP routing table with the rtdd function:
  1610.  
  1611. int
  1612. rtdd(target,gateway,metric,interface)
  1613. int32 target;     /* IP address of target */
  1614. int32 gateway;    /* IP addr of gateway to reach this target */
  1615. int metric;    /* "cost" metric, for routing decisions */
  1616. struct interface *interface;    /* device interface structure */
  1617.  
  1618. "target" is the IP address of the destination; it becomes the hash index key for subsequent packet destination address lookups.  If target == 0, the default entry is modified.  "metric" is simply stored in the table; it is available for routing cost calculations when an automatic routing protocol is written.  "interface" is the address of a control structure for the particular device to which the datagram should be sent; it is defined in the section "IP Interfaces".
  1619.  
  1620. rtdd returns 0 on success, -1 on failure (e.g., out of memory).
  1621.  
  1622. To remove an entry from the routing table, only the target address need be specified to the rtrop call:
  1623.  
  1624. int
  1625. rtrop(target)
  1626. int32 target;
  1627.  
  1628. rtrop returns 0 on success, -1 if the target could not be found.
  1629.  
  1630. 5.1.6. IP Interfaces
  1631.  
  1632. Every lower level interface used to transmit IP datagrams must have an "interface" structure, defined as follows:
  1633.  
  1634. /* Interface control structure */
  1635. struct interface {
  1636. struct interface *next;    /* Linked list pointer */
  1637. char *name;    /* Ascii string with interface name */
  1638. int16 mtu;    /* Maximum transmission unit size */
  1639. int (*send)();    /* Routine to call to send datagram */
  1640. int (*output)();    /* Routine to call to send raw packet */
  1641. int (*recv)();    /* Routine to kick to process input */
  1642. int (*stop)();    /* Routine to call before detaching */
  1643. int16 dev;     /* Subdevice number to pass to send */
  1644. int16 flags;     /* State of interface */
  1645. #define IFCTIVE 0x01
  1646. #define IFROADCAST 0x04    /* Interface is capable of broadcasting */
  1647. };
  1648.  
  1649. Part of the interface structure is for the private use of the device driver.  "dev" is used to distinguish between one of several identical devices (e.g., serial links or radio channels) that might share the same send routine.
  1650.  
  1651. A pointer to this structure kept in the routing table.  Two fields in the interface structure are examined by ipoute: "mtu" and "send".  The maximum transmission unit size represents the largest datagram that this device can handle; ipoute will do IP-level fragmentation as required to meet this limit before calling "send", the function to queue datagrams on this interface.  "send" is called as follows:
  1652.  
  1653. (*send)(bp,interface,gateway,precedence,delay,throughput,reliability)
  1654. struct mbuf *bp;    /* Pointer to datagram */
  1655. struct interface *interface;    /* Interface structure */
  1656. int32 gateway;    /* IP address of gateway */
  1657. char precedence;    /* TOS bits from IP header */
  1658. char delay;
  1659. char throughput;
  1660. char reliability;
  1661.  
  1662. The "interface" and "gateway" arguments are kept in the routing table and passed on each call to the send routine.  The interface pointer is passed again because several interfaces might share the same output driver (e.g., several identical physical channels).  "gateway" is the IP address of the neighboring IP gateway on the other end of the link; if a link-level address is required, the send routine must map this address either dynamically (e.g., with the Address Resolution Protocol, ARP) or with a static lookup table.  If the link is point-to-point, link-level addresses are unnecessary, and the send routine can therefore ignore the gateway address.
  1663.  
  1664. The Internet Type-of-Service (TOS) bits are passed to the interface driver as separate arguments.  If tradeoffs exist within the subnet between these various classes of service, the driver may use these arguments to control them (e.g., optional use of link level acknowledgments, priority queuing, etc.)
  1665.  
  1666. It is expected that the send routine will put a link level header on the front of the packet, add it an internal output queue, start output (if not already active) and return.  It must NOT busy-wait for completion (unless it is a very fast device, e.g., Ethernet) since that blocks the entire system.
  1667.  
  1668. Any interface that uses ARP must also provide an "output" routine.  It is a lower level entry point that allows the caller to specify the fields in the link header.  ARP uses it to broadcast a request for a given IP address.  It may be the same routine used internally by the driver to send IP datagrams once the link level fields have been determined.  It is called as follows:
  1669.  
  1670. (*output)(interface,dest,src,type,bp)
  1671. struct interface *interface;     /* Pointer to interface structure */
  1672. char dest[];    /* Link level destination address */
  1673. char src[];    /* Link level source address */
  1674. int16 type;    /* Protocol type field for link level */
  1675. struct mbuf *bp;    /* Data field (IP datagram) */
  1676.  
  1677.  
  1678. 5.1.7. IP Host Support
  1679.  
  1680. All of the modules described thus far are required in all systems.  However, the routines that follow are necessary only if the system is to support higher-level applications.  In a stand alone IP gateway (packet switch) without servers or clients, the following modules (IP user level, TCP and UDP) may be omitted to allow additional space for buffering; define the flag GWONLY when compiling iproute.c to avoid referencing the user level half of IP.
  1681.  
  1682. The following function is called by iproute() whenever a datagram arrives that is addressed to the local system.
  1683.  
  1684. void
  1685. ipecv(bp,rxbroadcast)
  1686. struct mbuf *bp;    /* Datagram */
  1687. char rxbroadcast;    /* Incoming broadcast */
  1688.  
  1689. ipecv reassembles IP datagram fragments, if necessary, and calls the input function of the next layer protocol (e.g., tcpnput, udpnput) with the appropriate arguments, as follows:
  1690.  
  1691. (*protrecv)(bp,protocol,source,dest,tos,length,rxbroadcast);
  1692. struct mbuf *bp;    /* Pointer to packet minus IP header */
  1693. char protocol;     /* IP protocol ID */
  1694. int32 source;    /* IP address of sender */
  1695. int32 dest;    /* IP address of destination (i.e,.  us) */
  1696. char tos;    /* IP type-of-service field in datagram */
  1697. int16 length;    /* Length of datagram minus IP header */
  1698. char rxbroadcast;    /* Incoming broadcast */
  1699.  
  1700. The list of protocols is contained in a switch() statement in the ipecv function.  If the protocol is unsupported, an ICMP Protocol Unreachable message is returned to the sender unless the packet came in as a broadcast.
  1701.  
  1702. Higher level protocols such as TCP and UDP use the ipend routine to generate IP datagrams.  The arguments to ipend correspond directly to fields in the IP header, which is generated and put in front of the user's data before being handed to ipoute:
  1703.  
  1704. ipend(source,dest,protocol,tos,ttl,bp,length,id,df)
  1705. int32 source;    /* source address */
  1706. int32 dest;    /* Destination address */
  1707. char protocol;    /* Protocol */
  1708. char tos;    /* Type of service */
  1709. char ttl;    /* Time-to-live */
  1710. struct mbuf *bp;    /* Data portion of datagram */
  1711. int16 length;    /* Optional length of data portion */
  1712. int16 id;    /* Optional identification */
  1713. char df;    /* Don't-fragment flag */
  1714.  
  1715. This interface is modeled very closely after the example given on page 32 of RFC-791.  Zeros may be passed for id or ttl, and system defaults will be provided.  If zero is passed for length, it will be calculated automatically.
  1716.  
  1717. 5.1.8. The Transmission Control Protocol (TCP)
  1718.  
  1719. A TCP connection is uniquely identified by the concatenation of local and remote "sockets".  In turn, a socket consists of a host address (a 32-bit integer) and a TCP port (a 16-bit integer), defined by the C structure
  1720.  
  1721. struct socket {
  1722. long address;    /* 32-bit IP address */
  1723. short port;    /*16-bit TCP port */
  1724. };
  1725.  
  1726. It is therefore possible to have several simultaneous but distinct connections to the same port on a given machine, as long as the remote sockets are distinct.  Port numbers are assigned either through mutual agreement, or more commonly when a "standard" service is involved, as a "well known port" number.  For example, to obtain standard remote login service using the TELNET presentation-layer protocol, by convention you initiate a connection to TCP port 23; to send mail using the Simple Mail Transfer Protocol (SMTP) you connect to port 25.  ARPA maintains port number lists and periodically publishes them; the latest revision is RFC-960, "Assigned Numbers".  They will also assign port numbers to a new application on request if it appears to be of general interest.
  1727.  
  1728. TCP connections are best modeled as a pair of one-way paths (one in each direction) rather than single full-duplex paths.  A TCP "close" really means "I have no more data to send".  Station A may close its path to station B leaving the reverse path from B to A unaffected; B may continue to send data to A indefinitely until it too closes its half of the connection.  Even after a user initiates a close, TCP continues to retransmit any unacknowledged data if necessary to ensure that it reaches the other end.  This is known as "graceful close" and greatly simplifies certain applications such as FTP.
  1729.  
  1730. This package is written as a "module" intended to be compiled and linked with the application(s) so that they can be run as one program on the same machine.  This greatly simplifies the user/TCP interface, which becomes just a set of internal subroutine calls on a single machine.  The internal TCP state (e.g., the address of the remote station) is easily accessed.  Reliability is improved, since any hardware failure that kills TCP will likely take its applications with it anyway.  Only IP datagrams flow out of the machine across hardware interfaces (such as asynch RS-232 ports or whatever else is available) so hardware flow control or complicated host/front-end protocols are unnecessary.
  1731.  
  1732. The TCP supports five basic operations on a connection: opencp, sendcp, receivecp, closecp and delcp.  A sixth, statecp, is provided mainly for debugging.  Since this TCP module cannot assume the presence of a sleep/wakeup facility from the underlying operating system, functions that would ordinarily block (e.g., recvcp when no data is available) instead set netrror to the constant EWOULDBLK and immediately return -1.  Asynchronous notification of events such as data arrival can be obtained through the upcall facility described earlier.
  1733.  
  1734. Each TCP function is summarized in the following section in the form of C declarations and descriptions of each argument.
  1735.  
  1736. int netrror;
  1737.  
  1738. This global variable stores the specific cause of an error from one of the TCP or UDP functions.  All functions returning integers (i.e., all except opencp) return -1 in the event of an error, and netrror should be examined to determine the cause.  The possible errors are defined as constants in the header file netuser.h.
  1739.  
  1740. /* Open a TCP connection */
  1741. struct tcb *
  1742. opencp(lsocket,fsocket,mode,window,rpcall,tpcall,spcall,tos,user)
  1743. struct socket *lsocket;    /* Local socket */
  1744. struct socket *fsocket;    /* Remote socket */
  1745. int mode;    /* Active/passive/server */
  1746. int16 window;    /* Receive window (and send buffer) sizes */
  1747. void (*rpcall)();    /* Function to call when data arrives */
  1748. void (*tpcall)();    /* Function to call when ok to send more data */
  1749. void (*spcall)();    /* Function to call when connection state changes */
  1750. char tos;    /* Internet Type-of-Service */
  1751. int *user;    /* Pointer for convenience of user */
  1752.  
  1753. "lsocket" and "fsocket" are pointers to the local and foreign sockets, respectively.
  1754.  
  1755. "mode" may take on three values, all defined in net.user.h.  If mode is TCPASSIVE, no packets are sent, but a TCP control block is created that will accept a subsequent active open from another TCP.  If a specific foreign socket is passed to a passive open, then connect requests from any other foreign socket will be rejected.  If the foreign socket fields are set to zero, or if fsocket is NULLSOCK, then connect requests from any foreign socket will be accepted.  If mode is TCPCTIVE, TCP will initiate a connection to a remote socket that must already have been created in the LISTEN state by its client.  The foreign socket must be completely specified in an active open.  When mode is TCPERVER, opencp behaves as though TCPASSIVE was given except that an internal "clone" flag is set.  When a connection request comes in, a fresh copy of the TCP control block is created and the original is left intact.  This allows multiple sessions to exist simultaneously; if TCPASSIVE were used instead only the first connect request would be accepted.
  1756.  
  1757. "rpcall", "tpcall" and "spcall" provide optional upcall or pseudointerrupt mechanisms useful when running in a non operating system environment.  Each of the three arguments, if non-NULL, is taken as the address of a user-supplied function to call when receive data arrives, transmit queue space becomes available, or the connection state changes.  The three functions are called with the following arguments:
  1758.  
  1759. (*rpcall)(tcb,count); /* count == number of bytes in receive queue */
  1760. (*tpcall)(tcb,avail); /* avail == space available in send queue */
  1761. (*spcall)(tcb,oldstate,newstate);
  1762.  
  1763. Note:    whenever a single event invokes more than one upcall the order in which the upcalls are made is not strictly defined.  In general, though, the Principle of Least Astonishment is followed.  E.g., when entering the ESTABLISHED state, the state change upcall is invoked first, followed by the transmit upcall.  When an incoming segment contains both data and FIN, the receive upcall is invoked first, followed by the state change to CLOSEAIT state.  In this case, the user may interpret this state change as a "end of file" indicator.
  1764.  
  1765. "tos" is the Internet type-of-service field.  This parameter is passed along to IP and is included in every datagram.  The actual precedence value used is the higher of the two specified in the corresponding pair of opencp calls.
  1766.  
  1767. opencp returns a pointer to an internal Transmission Control Block (tcb).  This "magic cookie" must be passed back as the first argument to all other TCP calls.  In event of error, the NULL pointer (0) is returned and netrror is set to the reason for the error.
  1768.  
  1769. The only limit on the number of TCBs that may exist at any time (i.e., the number of simultaneous connections) is the amount of free memory on the machine.  Each TCB on a 16-bit processor currently takes up 111 bytes; additional memory is consumed and freed dynamically as needed to buffer send and receive data.  Deleting a TCB (see the delcp() call) reclaims its space.
  1770.  
  1771. /* Send data on a TCP connection */
  1772. int
  1773. sendcp(tcb,bp)
  1774. struct tcb *tcb;    /* TCB pointer */
  1775. struct mbuf *bp;    /* Pointer to user's data mbufs */
  1776.  
  1777. "tcb" is the pointer returned by the opencp() call.  "bp" points to the user's mbuf with data to be sent.  After being passed to sendcp, the user must no longer access the data buffer.  TCP uses positive acknowledgments with retransmission to ensure in-order delivery, but this is largely invisible to the user.  Once the remote TCP has acknowledged the data, the buffer will be freed automatically.
  1778.  
  1779. TCP does not enforce a limit in the number of bytes that may be queued for transmission, but it is recommended that the application not send any more than the amount passed as "cnt" in the transmitter upcall.  The package uses shared, dynamically allocated buffers, and it is entirely possible for a misbehaving user task to run the system out of buffers.
  1780.  
  1781. /* Receive data on a TCP connection */
  1782. int
  1783. recvcp(tcb,bp,cnt)
  1784. struct tcb *tcb;
  1785. struct mbuf **bp;
  1786. int16 cnt;
  1787.  
  1788. recvcp() passes back through bp a pointer to an mbuf chain containing any available receive data, up to a maximum of "cnt" bytes.  The actual number of bytes received (the lesser of "cnt" and the number pending on the receive queue) is returned.  If no data is available, netrror is set to EWOULDBLK and -1 is returned; the rpcall mechanism may be used to determine when data arrives.  (Technical note: "rpcall" is called whenever a PUSH or FIN bit is seen in an incoming segment, or if the receive window fills.  It is called before an ACK is sent back to the remote TCP, in order to give the user an opportunity to piggyback any data in response.)
  1789.  
  1790. When the remote TCP closes its half of the connection and all prior incoming data has been read by the local user, subsequent calls to recvcp return 0 rather than -1 as an "end of transmission" indicator.  Note that the local application is notified of a remote close (i.e., end-of-file) by a statechange upcall with the new state being CLOSEAIT; if the local application has closed first, a remote close is indicated by a state-change upcall to either CLOSING or TIMEAIT state.  (CLOSING state is used only when the two ends close simultaneously and their FINs cross in the mail).
  1791.  
  1792. /* Close a TCP connection */
  1793. closecp(tcb)
  1794. struct tcb *tcb;
  1795.  
  1796. This tells TCP that the local user has no more data to send.  However, the remote TCP may continue to send data indefinitely to the local user, until the remote user also does a closecp.  An attempt to send data after a closecp is an error.
  1797.  
  1798. /* Delete a TCP connection */
  1799. delcp(tcb)
  1800. struct tcb *tcb;
  1801.  
  1802. When the connection has been closed in both connections and all incoming data has been read, this call is made to cause TCP to reclaim the space taken up by the TCP control block.  Any incoming data remaining unread is lost.
  1803.  
  1804. /* Dump a TCP connection state */
  1805. statecp(tcb)
  1806. struct tcb *tcb;
  1807.  
  1808. This debugging call prints an ASCII-format dump of the TCP connection state on the terminal.  You need a copy of the TCP specification (ARPA RFC 793 or MILSTD-1778) to interpret most of the numbers.
  1809.  
  1810. 5.1.9. The User Datagram Protocol (UDP)
  1811.  
  1812. UDP is available for simple applications not needing the services of a reliable protocol like TCP.  A minimum of overhead is placed on top of the "raw" IP datagram service, consisting only of port numbers and a checksum covering the UDP header and user data.  Four functions are available to the UDP user.
  1813.  
  1814. /* Create a UDP control block for lsocket, so that we can queue
  1815.  * incoming datagrams.
  1816.  */
  1817. int
  1818. opendp(lsocket,rpcall)
  1819. struct socket *lsocket;
  1820. void (*rpcall)();
  1821.  
  1822. opendp creates a queue to accept incoming datagrams (regardless of source) addressed to "lsocket".  "rpcall" is an optional upcall mechanism to provide the address of a function to be called as follows whenever a datagram arrives:
  1823.  
  1824. (*rpcall)(lsocket,rcvcnt);
  1825. struct socket *lsocket;    /* Pointer to local socket */
  1826. int rcvcnt;    /* Count of datagrams pending on queue */
  1827.  
  1828. /* Send a UDP datagram */
  1829. int
  1830. senddp(lsocket,fsocket,tos,ttl,bp,length,id,df)
  1831. struct socket *lsocket;    /* Source socket */
  1832. struct socket *fsocket;    /* Destination socket */
  1833. char tos;     /* Type-of-service for IP */
  1834. char ttl;    /* Time-to-live for IP */
  1835. struct mbuf *bp;    /* Data field, if any */
  1836. int16 length;    /* Length of data field */
  1837. int16 id;    /* Optional ID field for IP */
  1838. char df;    /* Don't Fragment flag for IP */
  1839.  
  1840. The parameters passed to senddp are simply stuffed in the UDP and IP headers, and the datagram is sent on its way.
  1841.  
  1842. /* Accept a waiting datagram, if available.  Returns length of datagram */
  1843. int
  1844. recvdp(lsocket,fsocket,bp)
  1845. struct socket *lsocket;    /* Local socket to receive on */
  1846. struct socket *fsocket;    /* Place to stash incoming socket */
  1847. struct mbuf **bp;    /* Place to stash data packet */
  1848.  
  1849. The "lsocket" pointer indicates the socket the user wishes to receive a datagram on (a queue must have been created previously with the opendp routine).  "fsocket" is taken as the address of a socket structure to be overwritten with the foreign socket associated with the datagram being read; bp is overwritten with a pointer to the data portion (if any) of the datagram being received.
  1850.  
  1851. /* Delete a UDP control block */
  1852. int
  1853. deldp(lsocket)
  1854. struct socket *lsocket;
  1855.  
  1856. This function destroys any unread datagrams on a queue, and reclaims the space taken by the queue descriptor.
  1857.  
  1858. 5.2. The KISS Host to TNC Protocol
  1859.  
  1860. 5.2.1. The Protocol Specification
  1861.  
  1862. 5.2.1.1. Introduction
  1863.  
  1864. The purpose of the "Raw" (aka "KISS") TNC is to facilitate the use of amateur packet radio controllers (TNCs) with host computers, particularly in the development of experimental protocols and multi-user servers (e.g., "bulletin boards").
  1865.  
  1866. Current TNC software was written with human users in mind; unfortunately, commands and responses well suited for human use are ill-adapted for host computer use, and vice versa.  This is especially true for multi-user servers such as bulletin boards which must multiplex data from several network connections across the single host/TNC link.  In addition, experimentation with new link level protocols is greatly hampered because there may very well be no way at all to generate or receive frames in the desired format without reprogramming the TNC.
  1867.  
  1868. The Raw TNC solves these problems by eliminating as much as possible from the TNC software, giving the attached host complete control over and access to the contents of the HDLC frames transmitted and received over the air.  The AX.25 protocol is removed entirely from the TNC, as are all command interpreters and the like.  The TNC simply converts between synchronous HDLC, spoken on the half duplex radio channel, and a special asynchronous, full duplex frame format spoken on the host/TNC link.  Every frame received on the HDLC link is passed intact to the host once it has been translated to the asynchronous format; likewise, asynchronous frames from the host are transmitted on the radio channel once they have been converted to HDLC format.
  1869.  
  1870. Of course, this means that the bulk of AX.25 (or another protocol) must now be implemented on the host system.  This is acceptable, however, considering the greatly increased flexibility and reduced overall complexity that comes from allowing the protocol to reside on the same machine with the applications to which it is closely coupled.
  1871.  
  1872. 5.2.1.2. Asynchronous frame format
  1873.  
  1874. The "asynchronous packet protocol" spoken between the host and TNC is very simple, since its only function is delimiting frames.  Each frame is both preceded and followed by a special FEND (frame end) character, analogous to an HDLC flag.  No CRC or checksum is provided.
  1875.  
  1876. The reason for both preceding and ending frames with FENDs is to improve performance when there is noise on the asynch line.  The FEND at the beginning of a frame serves to "flush out" any accumulated garbage into a separate frame (which will be discarded by the upper layer protocol) instead of prepending it to an otherwise good frame.  As with back-to-back FLAGs in HDLC, two FEND characters in a row should not be interpreted as delimiting an empty frame.
  1877.  
  1878. 5.2.1.2.1. Transparency
  1879.  
  1880. Frames are sent in 8-bit binary; if an FEND ever appears in the data, it is translated into the two byte sequence FESC TFEND (frame escape, transposed frame end).  Likewise, if the FESC character ever appears in the user data, it is replaced with the two character sequence FESC TFESC (frame escape, transposed frame escape).
  1881.  
  1882. As characters arrive at the receiver, they are appended to a buffer containing the current frame.  Receiving a FEND marks the end of the current frame.  Receipt of a FESC puts the receiver into "escaped mode", which causes the receiver to translate a following TFESC or TFEND back to FESC or FEND, respectively, before adding it to the receive buffer and leaving escaped mode.  (Receipt of any character other than TFESC or TFEND while in escaped mode is an error; no action is taken and frame assembly continues.  A TFEND or TESC received while not in escaped mode is treated as an ordinary data character.)
  1883.  
  1884. This procedure may seem somewhat complicated, but it is easy to implement and recovers quickly from errors.  In particular, the FEND character is never sent over the channel except as an actual end-of-frame indication.  This ensures that any intact frame (properly delimited by FEND characters) will always be received properly regardless of the starting state of the receiver or corruption of the preceding frame.
  1885.  
  1886. The special characters are:
  1887.  
  1888. FEND (frame end)    300 (octal)
  1889. FESC (frame escape)    333 (octal)
  1890. TFEND (transposed frame end)    334 (octal)
  1891. TFESC (transposed frame escape)    335 (octal)
  1892.  
  1893. (ARPA Internet hackers will recognize this protocol as identical to SLIP, a popular method for sending IP datagrams across ordinary dialup modems).
  1894.  
  1895. 5.2.1.3. Control of the Raw TNC
  1896.  
  1897. Each asynchronous data frame sent to the TNC is converted back into "pure" form and queued for transmission as a separate HDLC frame.  Although removing the human interface and the AX.25 protocol from the TNC makes most existing TNC commands unnecessary (i.e., they become host functions), the TNC is still responsible for keying the transmitter's PTT line and deferring to other activity on the radio channel.  It is therefore necessary to allow the host to control a few TNC parameters, namely the transmitter keyup delay and the transmitter persistence variables.
  1898.  
  1899. It is therefore necessary to distinguish between command and data frames on the host/TNC link.  This is done by defining the first byte of each asynchronous frame between host and TNC as a "type" indicator.  The following types are defined in frames to the TNC:
  1900.  
  1901. Type     Function    Comments
  1902. 0    Data frame    Rest of frame is data to be sent on the HDLC channel
  1903. 1    TXDELAY    Second byte is transmitter keyup delay in 10 ms units
  1904. 2    P    Second byte of frame is persistence parameter, p:
  1905.         0: p = (0+1)/256, 255: p = (255+1)/256 = 1.0
  1906. 3    SLOTTIME    Second byte of frame is slot interval in 10 ms units
  1907. 4    TXtail    Second byte of frame is time to hold up the TX after the FCS has been sent (the time allowed to send the HDLC flag character; should be at least 2 for 1200 bps operation).  In 10 ms units.
  1908.  
  1909. The following types are defined in frames to the host:
  1910.  
  1911. Type    Function    Comments
  1912. 0    Data frame    Rest of frame is data from the HDLC channel
  1913.  
  1914. (No other types are defined; in particular, there is no provision for acknowledging data or command frames sent to the TNC.)
  1915.  
  1916. 5.2.1.4. Persistence
  1917.  
  1918. The P and SLOTTIME parameters are used to implement true p-persistent CSMA.  This works as follows:
  1919.  
  1920. Whenever the host has queued data for transmission, the TNC begins monitoring the carrier detect signal from the modem.  It waits indefinitely for this signal to go inactive.  Once the channel is clear, the TNC generates a random number between 0 and 255.  If this number is less than or equal to P, the TNC asserts the transmitter PTT line, waits .01 * TXDELAY seconds, and transmits all frames in its queue.  The TNC then releases PTT and goes back to the idle state.  If the random number is greater than P, the TNC delays signal has gone active in the meantime, the TNC again waits for it to clear before continuing).  Note that P=255 means always transmit as soon as possible, regardless of the random number.
  1921.  
  1922. The result is that the TNC waits for an exponentially-distributed random interval after sensing that the channel has gone clear before attempting to transmit.  The idea here is that with proper tuning of the parameters P and SLOTTIME, several stations with traffic to send are much less likely to collide with each other when they simultaneously see the channel go clear.
  1923.  
  1924. 5.2.2. The TNC-2 Implementation
  1925.  
  1926. See the files included in the TNC-2 KISS Distribution.
  1927.  
  1928. 5.2.3. The TNC-1 Implementation
  1929.  
  1930. See the files included in the TNC-1 KISS Distribution.
  1931.  
  1932. 5.2.4. The VADCG/ASHBY Implementation
  1933.  
  1934. See the files included in the VADCG/ASHBY KISS Distribution.
  1935.  
  1936. 5.2.5. The AEA Implementation
  1937.  
  1938. All PK-232 units with WEFAX, and PC-87 units of a similar vintage, are capable of KISS operation.  See the installation instructions earlier in this document for more information.
  1939.  
  1940. 5.2.6. The Kantronics Implementation
  1941.  
  1942. See your Kantronics TNC Documentation.
  1943.  
  1944. 5.3. The Experimental DES Package
  1945.  
  1946. Documentation is included in the DES package.
  1947.